0

In my php.ini file on wampserver I have the following lines set:

error_reporting = E_ALL
display_errors = On

Yet, I have to actually call error_reporting(E_ALL) in my script in order for it to actually show the errors.

Why is this happening? I'm getting to my php.ini through the wampserver icon -> php -> php.ini

kjdion84
  • 9,552
  • 8
  • 60
  • 87

2 Answers2

0

In WAMPServer there are 2 php.ini files:

  1. \wamp\bin\php\php{version}\php.ini (controls only PHP CLI)

  2. and the one that controls the Apache/PHP environment.

Edit the Apache version by using the wampmanager menus, so you get the right one.

wampmanager->PHP->php.ini

This will open the correct file in your default editor. Change the parameters in this file, save it and restart Apache.

BEWARE: If as you say you are using the correct method to edit the correct file -

These parameters are also documented at the top of the php.ini file, do not change the documentation version, look further down the file and edit the actual parameters there.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • this is correct and well descriptive. And important is to restart apache – Alive to die - Anant Feb 16 '17 at 16:38
  • I already did this....and my phpinfo() tells me `error_ reporting` is set to `32767`. – kjdion84 Feb 16 '17 at 16:44
  • I dont suppose you are turning errors OFF somewhere in an include that everything includes are you? Grasping at straws now – RiggsFolly Feb 16 '17 at 16:52
  • No. What is weird is I am using an MVC framework I coded and if I put `error_reporting(E_ALL)` at the top of the bootstrap file it doesn't work, I have to actually put that code in the file causing the fatal error itself. Also, I checked and no composer package is manipulating any php.ini settings. – kjdion84 Feb 16 '17 at 17:26
  • OK this is bizarre. When I run a script that only contains `phpinfo()` its telling me `error_reporting` is set to `32767`. However, I just put `phpinfo()` in the script not showing the errors, and its telling me the `error_reporting` value is `0`. I ransacked the entire project and nowhere is `error_reporting` or `ini_set` being defined. – kjdion84 Feb 16 '17 at 17:34
  • It seems that `error_reporting` is being reset inside of my class methods. I just read on the PHP website `The following error types cannot be handled with a user defined function`. Does this mean that PHP will always ignore my ini settings for fatal error reporting within class methods? – kjdion84 Feb 16 '17 at 17:45
  • That is not a default condition. there must be something somewhere specifically turning error reporting off. **What framework are you using?** – RiggsFolly Feb 16 '17 at 19:16
  • [Like I said earlier](http://stackoverflow.com/questions/42279497/php-ini-error-reporting-set-to-e-all-but-not-working/42279642?noredirect=1#comment71716680_42279642) – RiggsFolly Feb 16 '17 at 19:28
0

I was using the @ suppression modifier in front of call_user_func_array in my Router front-end controller class which was resetting error_reporting to 0.

kjdion84
  • 9,552
  • 8
  • 60
  • 87