I am having an issue when I have a php application that is returning an internal server error (500) however nothing is showing up in the error log.
Now I know there
If you still have 500 error and no logs you can try to execute from command line:
php -f file.php
it will not work exactly like in a browser (from server) but if there is syntax error in your code, you will see error message in console.
Here is another reason why errors might not be visible:
I had the same issue. In my case, I had copied the source from a production environment. Hence the ENVIRONMENT
variable defined in index.php
was set to 'production'
. This caused error_reporting
to be set to 0 (no logging). Just set it to 'development'
and you should start seeing error messages in apache log.
Turned out the 500 was due to a semi colon missing in database config :-)
SOLVED I struggled with this and later on, I realized that I was working on PHP 5.6, so I upgraded to PHP 7.0, then I released there were comments placed by git for conflicting codes. I found something like this in my code <<<<<<<< But solved it.
Another case which happened to me, is I did a CURL to some of my pages, and got internal server error and nothing was in the apache logs, even when I enabled all error reporting.
My problem was that in the CURL I set
curl_setopt($CR, CURLOPT_FAILONERROR, true);
Which then didn't show me my error, though there was one, this happened because the error was on a framework level and not a PHP one, so it didn't appear in the logs.
Be sure your file permissions are correct. If apache doesn't have permission to read the file then it can't write to the log.
Maybe something turns off error output. (I understand that you are trying to say that other scripts properly output their errors to the errorlog?)
You could start debugging the script by determining where it exits the script (start by adding a echo 1; exit;
to the first line of the script and checking whether the browser outputs 1
and then move that line down).