Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
Unfortunately, it's still sending deprecated emails. Should I make a similar adjustment within the php.ini ? –  Webnet Aug 29 '10 at 3:51
1  
Based on the this bug (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 4:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.