This afternoon an interesting problem came to my attention. This problem is the result of PHP and mod_perl being used together on Apache server. The full details of the problem can be found
here.
The quick summary is that if PHP code uses putenv() function it will conflict with mod_perl and cause frequent crashes. The suggested solution is to use the Apache's apache_setenv() function. However, as I found out this does not always work.
In my case I need to set the TZ environment variable that allows me to change the timezone. The tricky thing about timezone changes is that after TZ is changed, a libc function tzset() needs to be called to activate the change. PHP's own putenv() calls this function if it detects that the TZ environment variable is being changed, Apache SAPI function apache_setenv() does not. This means that the environment var change does not accomplish the desired goal. Even if I were to modify (tried doing this) the PHP source code to call this function it still wouldn't work because the libc tzset() function reads the TZ environment variable from the system and not Apache. The apache_setenv() of course modifies the Apache's internal environment only.
The only solution it seems to disable usage of putenv() when Apache with PHP and mod_perl is encountered.