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.
Related Posts:
Filed Under: FreeBSD General
September 13th, 2011 at 12:53 pm
Thanks,
I can use these.
I had to copy over a website,
du said it had grown to 27GB
since “we” had made it.
The find ./ -maxdepth 4 -size +20M found
a deprecation log of 24GB !
mistige
September 16th, 2011 at 12:45 am
We had a nightmare with log files building up and causing a server to grind to a halt before we narrowed down the problem back to PHP 5.3. Now on 5.3.8 and fixed the buildup!