Marius van Witzenburg We fight for our survival, we fight!

9jun/110

E_STRICT crashes php if date.timezone is not set in php.ini

Posted by mariusvw

In case you use the following in your php.ini:

error_reporting = E_ALL | E_STRICT

You might notice that if you do a phpinfo() that php crashes the apache child.

Reason is a bug in php that causes an infinite loop.

You can solve this by setting "date.timezone =" to your timezone.

You can also set this in your script with ini_set() but I would go for the php.ini since thats a more permanent solution.

For a list of timezones check:
http://www.php.net/datetime

Geëtiketeerd als: , , , , Geen reacties
9jun/110

How to enable error reporting in PHP

Posted by mariusvw

When you are developing something new in PHP you might want to enable error reporting so you can see what is going wrong and that you are working by the strict guidelines of PHP.

With this you can enable displaying errors in your browser and you can also save it to an error log if you want.

Note for PHP5.3 and above, E_ALL includes E_STRICT so you can leave out the "| E_STRICT" part.

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
# Optional
ini_set('error_log', '/data/www/marius/php_error.log');

You can also use these in your php.ini if you want.

Geëtiketeerd als: , , , , , Geen reacties