The joy of suexec

So we were trying to set up a shim web script to connect a MySQL database full of data goodness to a set of LSL scripts. The python script when run from the command line in the development environment but failed utterly when the author tried deploying it to our hosted server. It turns out that there was a whole cascade of problems that may serve as a cautionary tale:

  • The database server didn’t allow connections from outside our campus, so we needed to deploy to an external machine at work instead of our public services to satisfy the need for LSL to reach the server and for the server to reach the database.
  • Check EOLs!  The script was developed on windows and then deployed to Linux – while python worked fine, ./ failed because the engine didn’t recognize the ^M as an EOL on the first line.  dos2unix fixed that. Renamed it foo.cgi and it should work
  • suexec is evil.  It intentionally obscures its settings and (probably unintentionally) emits error messages that are simply wrong.  Our webserver used the standard install, but we use .public_html as the user’s html directories instead of the more common public_html (note the dot!).  Suexec said that it couldn’t get to /home/user, whereas it really couldn’t get to /home/user/public_html.  The hack to get things working was to symlink the two together.

Presto! And suddenly things worked!  Of course, there were multiple edits of apache config along the way, restarts, searching for working user scripts, etc.