Question

I'm testing PHP on a LAMP server running in a Linux virtual machine. Following this post, I placed the following at the beginning of my PHP script to enable error reporting:

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

I also tried enabling error reporting in the php.ini file as described here:

display_errors = On
display_startup_errors = On
error_reporting = -1

However, I still get a 500 Internal Server Error in Chrome's debugger, rather than a proper error message:

enter image description here

The actual error message, as found in /var/log/apache2/error.log, is:

PHP Parse error: syntax error, unexpected '$userID' (T_VARIABLE) in /path/to/file

How can I properly enable error reporting within Chrome?

Was it helpful?

Solution

That is Apache (server) response and (probably) has nothing to do with php.
It simply states that there is something wrong with your server configuration. Check the access.log and error.log in /var/log/apache2/ folder. It is probably due to wrong configuration in /etc/apache2/apache2.conf, or in /var/www/.htaccess (if you have one).

I would also check if list.php exists in webroot folder and if both folder and file are readable (use chmod -R 755 /var/www in cli to make all files and folders readable)

OTHER TIPS

You should check that you are in an development environment and not production environment. Depending on the HOSTS, that may be in a config file. Here's an example :

app.engine=php
app.engine.version=5.6
http.firewall=none
environment=development

In that way you can see your error ! Then when you're done, you can put environment=production and if the error is still there the user will see ERROR 500.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top