PHP 5.3 Isn’t That Bad
July 29, 2011 Posted by KP
I complained about php5.3 generating huge log files, also, E_DEPRECATED doesn’t suppress those deprecated errors, as a result, I had to turn off php logs. Actually it doesn’t have to be that bad.
The reason why E_DEPRECATED doesn’t work is that, some scripts set error_reporting value and supersede the setting in php.ini, so, no matter how we configure php, we just couldn’t suppress those errors. Obviously, the best solution is modifying the scripts, but I didn’t want to risk breaking the code and had never given it a try. I was very wrong, the best solution is actually also the easiest solution, there is no risk at all. I fixed a dozen scripts within a couple of hours – just very simple replace.
Here are some common deprecation errors I encountered:
Error: date() [function.date]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting. Old versions of WordPress generate crazy logs of this error.
Solution: Set a default timezone in php.ini, my server was changed to
date.timezone = “America/Phoenix”
Here is the list of supported timezones.
Error: PHP Deprecated: Assigning the return value of new by reference is deprecated
Solution: Replace “‘=& new” with “= new”.
Error: Function split() is deprecated.
Solution: Most scripts don’t use the regex version, simply replace “split” with “explode”.
There are some other errors but I don’t remember right now, just search online, there should always be a very easy solution.
Filed Under: FreeBSD General