2

SOLUTION: Bunyamin's comment was my solution.

display_errors for php5-fpm not working with nginx

The second answer of that question mentioned the /etc/php5/fpm/pool.d/*.conf files, in my case /etc/php5/fpm/pool.d/www.conf

There I added

php_flag[display_errors] = on

and now it works.

QUESTION:

I have already turned on error reporting in the /etc/php5/cgi/php.ini file and no errors are shown.

If I add

error_reporting(E_ALL);
ini_set('display_errors', 1);

to my PHP code, all the errors are shown.

Why doesn't it work if I turn on error reporting in the php.ini files and don't add that code snippet? Shouldn't the php.ini file do the same as the code?

Webserver: Lighttpd OS: Raspbian Jessie

EDIT: phpinfo() shows that display_errors is set to Off, but in the php.ini file its turned On.

My php.ini file: http://pastebin.com/1qeK310n

Output of phpinfo(): http://www.file-upload.net/download-11264468/phpinfo.htm.html

11
  • You only need to have one of those, I personally always have error_reporting(E_ALL); Commented Jan 31, 2016 at 12:18
  • which OS you are using ? windows or linux ? Commented Jan 31, 2016 at 12:20
  • did you restart apache? Commented Jan 31, 2016 at 12:23
  • 2
    Depending on how you use php inside your http server environment you need to restart the http server after changing the php configuration for the changes to be picked up. Commented Jan 31, 2016 at 12:23
  • 2
    OK, if that really does not pick up changed settings in your configuration file then either you did not really change those files or php uses another configuration file (or none). I suggest you use the famous phpinfo() test page to check what configuration file is used. Commented Jan 31, 2016 at 12:27

2 Answers 2

4

I have four suggestions.

First of all, make sure that you are editing the correct php.ini file. You can see which php.ini file is used with the function phpinfo().

Simply create a file, phpinfo.php, with the following content. When you load the page (http://yoursite.com/phpinfo.php), you can see the details about your PHP configuration.

<?php
    echo phpinfo();

Secondly, make sure you set error_reporting to E_ALL to get full debug information (Suggested only in development).

Thirdly, is there anywhere in your application that you set display_errors to 0. Sometimes, especially in frameworks, this property is set to 0.

Lastly, sometimes Apache is configured in a way that a custom php.ini file located in the root directory of your webpage can override your global configuration. Then the change in global php.ini file would not affect your application.

Sign up to request clarification or add additional context in comments.

8 Comments

1. I already checked, I edited the correct file 2. I set error_reporting to E_ALL 3. I don't think so, I'm only using MariaDB, do you think it sets display_errors to 0? 4. I'm using Lighttpd and there is no custom php.ini file
One more... write a test script,, In a new base folder in side of www... This will rule out your project.
Andreas, you wrote a test script outside of your project, and the result is the same? display_errors is still set to 0?
Andreas, would you also add the output of phpinfo() to your question?
You should check the following link: stackoverflow.com/questions/13929314/…
|
1

You have to scroll down to where the display_errors is set to OFF an then turn it on (Don't uncomment and set to on, scroll down)

6 Comments

There are 2 one you have to uncomment and one you have to scroll down to find which is default if you have already turned that one On then you may are editing the wron ini file create a php page and look at the output of <?php echo phpinfo()K ?>
Hmm and is phpinfo() saying the display_errors is turned on or off ?
In the core section it says that display_errors is turned Off. But in the php.ini file phpinfo() mentions, it's turned On
Would you care to upload you php.ini file?
After restarting your webserver the value of display_errors is still Off but the phpinfo() displays it is turned Off? (Where is your webserver running?)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.