image

Sascha Depold

Engineering Manager

Blog

Disabling error reporting of PHP on Snow Leopard

Due to my studies I’m currently working with Typo 3. I wanted to setup the CMS on my Snow Leopard based MacBook and ended in a bunch of warnings. Most of them informed about the use of deprecated function calls. First I just thought: Well that’s not my business! BUT: Because warnings are passed to the browser just when they appear, PHP is not more able to redirect to another page using PHPs header function.

To disable the so-called error_reporting do the following:

sudo cp /etc/php.ini.default /etc/php.ini
sudo chmod 644 /etc/php.ini
sudo mate|pico|nano|vi /etc/php.ini

The last command will open your most favorite ultimate text editor! I figured out, that using the complete default php.ini will cause several strange behaviors. For example I wasn’t able to connect to my MySQL database after using the new php.ini. So I just deleted most of it’s content and only using that:

error_reporting = E_ALL
display_errors = Off

Actually I think that the whole magic is in that display_errors attribute :> There are a lot of combinations for the error_reporting field … but none of them worked for me !? I thought something like E_ALL & ~E_DEPRECATED should do the trick.

One necessary thing you have to do in order to enable the new configuration:

sudo apachectl restart

Have fun :)