Dr. Hain's various/sundry has helpful information about things
that Dr. Hain has discovered by trial and error.
phpESP -- takes a lot of work to get it useful
This page was last updated on
December 8, 2018
phpESP is an open source survey software. ESP is for "easy survey package". phpESP appears to be designed to be a method to deliver questionnaires, similar to "limesurvey". It is not so hard to get it to also serve tests (i.e. lists of questions with the respondent's identity preserved). I had some major issues with limesurvey a few years ago, and for this reason decided to see if I could get phpESP going.
Although there are claims on the web that phpESP is easy to install, such as 2003 techrepublic article (ok, 14 years ago), phpESP does not install in a usable form when one takes the straightforward approach of downloading it from github and untarring (at least as of 2017). There do not appear to be any usable forks either.
While phpPSP, like limesurvey, is "documentation lite", it is not quite as impenetrable as limesurvey code, perhaps because it has not been maintained for roughly 10 years, and has not been "upgraded" to some PHP package that makes life easier for professional programmers but harder for unprofessional ones like me. Also, because it is evidently a failed survey package, the code may not be as "obfusticated" as the limesurvey code, where the developers sell support. The phpPSP programmers tried to put together some documentation, which is better than nothing, but not quite a user manual.
I got phpESP to work in 2017, and this page documents the project.
phpESP is open source. I am happy to provide a copy of my changed code on request.
Important stuff to know about phpESP:
- phpESP DOES NOT work "out of the box" from github. The github version has innumerable problems. You first need to set up the database, and also to initialize the root password (I used phpmyadmin to do this). See below.
- The administration console is at phpESP/admin/
- The public interface is at phpESP/survey.php
- This is not a "pretty" survey manager. If you need something prettier, go elsewhere. You can adjust the css so that it is OK though. I myself created a css called "template2.css".
- You can turn on the "debug" interface in the config file. This is slightly helpful.
- This software was written in 2008, but by 2017, many parts of PHP have changed since it was written. In particular, there is heavy use of the "ereg" and "split" PHP functions, which are now replaced by preg_match, and preg_split. All of these need to be modified. This code may have been developed without turning on the PHP warnings (wow). This creates an immense # of errors when one turns on. As these functions are removed in php 7.0, they have to be replaced now or later.
- There is an IMMENSE amount of code here related to user logins, which doesn't work on installation. This leads to a "catch 22" problem that one can't run the program to see if it works, because you never get past the login page.
- I solved this by tracking through the code to find the authorization code, and forcing it to authorize everyone. Once I figured out step 3-a-b (i.e. how to reset the root password), then I went back and could login normally. See below for information how to reset the root password.
- The installation process doesn't work -- one must (by hand)
- Create the phpESP database in mysql (I used phpmyadmin to do this).
- Reset the root password manually (I used phpmyadmin again). I followed executed this command from the console:
- update set password = PASSWORD('12345') where username = 'root';
- Deal with the innumerable PHP warnings deriving from #1.
- Session code needs to be updated nearly everywhere. This program uses sessions variables to store data rather than globals.
- Although the documentation says that the installation runs off of the included sql and xml files, this is not a reliable way to go about it, because the code does not adapt to new fields.
- Date format is not US standard -- for example, on Dashboard it says Welcome, Tim Hain. Right now, my watch shows 28/07/2017. This can be readjusted fairly easily.
- The Dashboard does not come turned on by default -- you just get a blank page. It can be configured to start however. The dashboard is basically a standalone public interface to all of your questionnaires. It is not very useful however.
- The Dashboard does not find historical surveys.
- There are issues with being unable to logout. Perhaps because there is no logout function. Hm. The login system uses session variables -- which interacts with other software that uses session variables too. Not a good choice.
- Export is through csv (a little crude). Sending Json seems a little more sensible.
- The database primitives are ... primitive. The survey_copy function, in particular, is crude. It hand-codes in every single field. This means if you change anything in the database, you have to go back and edit this code. I hand-edited the code, but it needs a rewrite. There is a general technique of assigning variables from the database to a list of field names. This is fast, but doesn't "stretch" when there are new field names.
- This package uses a very odd methodology of loading in ".inc" files, which most people would call .php files. This has the good feature of modularity -- you just see one piece at a time. It has the very bad feature of confusing my web editor (dreamweaver), so the color coding and syntax checking is turned off. I think it is best not to use this method.
Enhancements I made to phpESP (this is very old -- many more improvements made by 12/2018)
- I needed questions that are quantified Likert scales. For example, the "ABC" questionnaire for balance. I accomplished this by modifying the phpESP question driver and database, to accept a new "CsvLabel" field, which is a comma delimited array of labels to go on the "rate"question. By setting the "length" of the rate question to 11 (0-100%), and setting the "CsvLabel" field to be "0%,10,20,30,40,50,60,70,80,90,100%", I got the desired behavior of a "rate" question denominated in percentages. Obviously one could use this for other stuff -- like yes/no/maybe (for example).
- Changed the shading on the lines for the rate question (see above) so it alternates.
phpESP is a bit crude as well as needs a lot of work, but nevertheless this is possible, probably because it is a very old piece of software.
December 8, 2018
, Timothy C. Hain, M.D.
All rights reserved.