DreamHost has recently disabled all PHP warnings by default.
I guess that’s a good idea in a production environment, but I’ve been using Dreamhost for teaching PHP since we left our previous web hosting provider MyServerWorld in 2010.
I’m not sure why Dreamhost decided to change error handling recently, but now my students don’t know where the mistakes in their code are. The fact that this happened just before the main assignment wasn’t great timing.
Dreamhost’s Knowledge Base only shows how to turn on logging into a file, not how to display the error message as before. The following instructions are useful for my BT2201 and BT3023 students, but maybe also for other Dreamhost users.
Turning on display_errors
To see the error message, rather than a generic ‘500 internal server error’ we can change the php.ini file (called phprc on Dreamhost).
- Every account should see a ‘.php’ folder when logged in via (S)FTP.
- In that folder, there will be different folders for the different versions of php offered. Currently, that’s everything from 5.3 to 7.2. I assume they are all there because an account can have more than one domain and different domains can be set to run on different versions of php.
- Add the following line to the top of the phprc file:
display_errors = On
If it didn’t work within a few minutes…
The new settings should come into effect within a few minutes, but if they don’t you can do the following.
To kill off running PHP processes you need to log in via SSH (which my students can’t do) and run
killall -9 php70.cgi
or the appropriate command for the php version used (e.g. php56.cgi instead of php70.cgi).
Alternatively, you can open the ‘Manage Domains’ settings page on Dreamhost’s web interface (something my students can’t do either) and just resave your settings.