1

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?

Community
  • 1
  • 1
1''
  • 26,823
  • 32
  • 143
  • 200
  • Can you show us the ` phpinfo(); ?>` output in a jsFiddle? (View source of the page, paste it in a jsFiddle, save it and post the link) – Amal Murali Sep 02 '13 at 20:04
  • @AmalMurali Which page do you mean? I can't post my actual code for privacy reasons. – 1'' Sep 02 '13 at 20:08

2 Answers2

1

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)

Ivan Hušnjak
  • 3,493
  • 3
  • 20
  • 30
  • I've received a 500 Internal Server Error on Google App Engine even when everything is functioning correctly. The page also loads fine, up until the point where it has to run the PHP script, which indicates that it's not a server configuration issue. In fact, after looking at the error logs, it does turn out to be a PHP syntax error! I'll accept your answer for now, but I'm really looking for a way to display the error directly in Chrome. – 1'' Sep 02 '13 at 20:45
0

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.