HomeSearchDr. Hain Clinic website Information for Dizzy Patients MusicFLWVarious and Sundry

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.

phpESP is a substantial piece of programming, including about 350 files, originally written in 2002, and apparently untouched from 2008 through 2017. It is a mixture of php, html, css and javascript. There is also some obscure "ado" database calls, and some translation capability. The ADO may be good - -I am not so sure. The idea seems to be able to support databases other than mysql, but this ability seems to me to be of very limited utility. Regarding the translation, it seems a little silly in these days of browser based translation.

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:

  1. 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.
  2. The administration console is at phpESP/admin/
  3. The public interface is at phpESP/survey.php
  4. 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".
  5. You can turn on the "debug" interface in the config file. This is slightly helpful.

Major problems:

  1. 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.
  2. 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.
    1. 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.
  3. The installation process doesn't work -- one must (by hand)
    1. Create the phpESP database in mysql (I used phpmyadmin to do this).
      1. Reset the root password manually (I used phpmyadmin again). I followed executed this command from the console:
        1. update set password = PASSWORD('12345') where username = 'root';
    2. Deal with the innumerable PHP warnings deriving from #1.
    3. Session code needs to be updated nearly everywhere. This program uses sessions variables to store data rather than globals.
    4. 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.
  4. 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.
  5. 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.
  6. The Dashboard does not find historical surveys.
  7. 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.
  8. Export is through csv (a little crude). Sending Json seems a little more sensible.
  9. 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.
  10. 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)

  1. 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).
  2. Changed the shading on the lines for the rate question (see above) so it alternates.
  3. The "add answer_line" button and the "Clear all answers" (written in Javascript) didn't work. I rewrote them so that they do work. There is still no method of adding a question (e.g. answer) in the middle of a list. One can delete easily by just blanking it out. One can add onto the end as well.



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.

© Copyright May 3, 2021 , Timothy C. Hain, M.D. All rights reserved.
Dr Hain's CV Clinic dizziness-and-hearing.com FLW Various and Sundry Dr. Hain's CV