1

i've a problem with my http server (actually Apache 2.4.7 and PHP 5.5.8-2) running on debian. Without enabled display_errors the server returns, as expected a 500-http error, but when enabling display_errors using php.ini or apache vhost directives the server only returns a blank (or whatever output occured until the error) to the client. I'm not able in any way to show the actual occured php error.

Here i've the configuration parts from phpinfo()

error_reporting         0
display_errors          On
display_startup_errors  On
html_errors             On
log_errors              On

And here is the actual php file i try to test

<?php
echo "A message before php-error occurs";
foobar1();
echo "A message after error occured";
?>

The second message is not displayed, just as there is no php error output, neither in the http request nor in the error log of the server. HTTP Status Code is 200.

HTTP/1.1 200 OK
Date: Sun, 16 Mar 2014 16:18:36 GMT
Server: Apache/2.4.7 (Debian)
Strict-Transport-Security: max-age=604800
X-Powered-By: PHP/5.5.8-2
Content-Length: 33
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

A message before php-error occurs

If anyone has an idea what the problem is it would be great if i get a reply. In the moment i've to copy the production platform every time when an error occurs on a local machine to get the php error output.

foxylion
  • 393
  • 1
  • 13
  • How about error logs? Why do you suppress `E_NOTICE`? – zerkms Mar 16 '14 at 21:02
  • I've updated my test scenario and my post, `E_NOTICE` is not the problem. Also the given code example should end in a real error no notice. Error logs are always empty, don't know why, on my local instance it works.. – foxylion Mar 17 '14 at 09:30
  • Are you sure you're running this particular script? If you replace it all with ` – zerkms Mar 17 '14 at 09:56
  • Yes i am sure that i edited the right script. Here i've a example: http://test.foxylion.de/ all files are shown (inclusive configuration and log file). – foxylion Mar 17 '14 at 13:38
  • 1
    Do you see the actual "E_ALL" string in `phpinfo()`'s output? How exactly do you set the value? – Álvaro González Mar 18 '14 at 08:05

1 Answers1

1

Looking at your phpinfo.php error_reporting has a value of 0, which implies that it's not being set from your virtualhost config.

According to the PHP documentation

Using PHP Constants outside of PHP, like in httpd.conf, will have no useful meaning so in such cases the integer values are required. And since error levels will be added over time, the maximum value (for E_ALL) will likely change. So in place of E_ALL consider using a larger value to cover all bit fields from now and well into the future, a numeric value like 2147483647 (includes all errors, not just E_ALL).

Insert the numeric constant for E_ALL ( 32767 ) in your virtualhost.conf.

A full list of error code constants can be found here: http://www.php.net/manual/en/errorfunc.constants.php

You can also try inserting

error_reporting(E_ALL);

at the top of your PHP script to see if you get the error reports shown that way.

DorianFM
  • 4,354
  • 1
  • 16
  • 20
  • Thanks a lot, it was the problem. If set the error_reporting value with `php_admin_value` and `E_ALL`. So it was fixed to `0` and therefore any override I tried in php files failed. – foxylion Mar 18 '14 at 17:56