I am running nginx with PHP-FPM. My nginx configuration for handling php files looks like this:

location  ~ \.php$ {
            set $php_root /home/me/www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $php_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }

Now, I have a simple php file like this:

<?php
     ech "asd"
     asd""
?>

Yes, with an obvious error. When I try accessing the php file, instead of tracing a syntax error, I always get a HTTP 500 Internal Server Error.I tried using error_reporting(-1); but still it always returns HTTP 500. How do I get PHP to print the exact error instead of returning a generic HTTP 500?

Comments

If the file didn't have the error, would you get the correct response code (HTTP 200 OK)?

Written by echo

Yes, I get a HTTP 200 OK if the file doesn't have an error.

Written by ErJab

Accepted Answer

try find this in ur php.ini: display_errors = Off , then make it on

Written by SpawnCxy
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki