0

I've setup php5-cli and everything's working great except I keep getting emails containing deprecated notices such as:

PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0

Within the cron files that are running I also have:

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

If I understand correctly that should report all errors except for notices and deprecated messages. I also have this specified within the php.ini for cli.

Ben
  • 3,800
  • 18
  • 65
  • 96

2 Answers2

1

Your logic is incorrect with the ands. Based on what you have written, it will report all as long as its NOT both E_NOTICE and E_DEPRECATED, whereas you probably meant either or.

error_reporting(E_ALL ^ ( E_NOTICE | E_DEPRECATED));

The above says, report all errors except E_NOTICE or E_DEPRECATED.

Andrew M.
  • 11,182
  • 2
  • 35
  • 29
  • Unfortunately, it's still sending deprecated emails. Should I make a similar adjustment within the php.ini ? – Ben Aug 29 '10 at 03:51
  • 1
    Based on the this bug (https://bugs.launchpad.net/ubuntu/+source/php-mcrypt/+bug/540208), the error is being thrown BY the command line client--meaning its happening before your script is being run. Theoretically, yes, adding this to the php.ini file would work--but make sure you add it to the right one; there is a hierarchy to how configs get read in. – Andrew M. Aug 29 '10 at 04:03
1

The file /etc/php5/cli/conf.d/mcrypt.ini is evaluated before your error_reporting() function is called.

Just correct the file (replace # by ;) and you're fine.

joschi
  • 21,387
  • 3
  • 47
  • 50