I've got a PHP script that can take about thirty seconds to accomplish. When running it through php cli it finishes effectively (echos a confirmation and saves relevant produces a file on the local file system). Basically run exactly the same file through Apache, it appears to break or something like that, after about thirty seconds approximately, rather than the expected confirmation message, Opera offers me to download a clear file (other browsers address it in a different way, but essentially, something didn't go as planned). The file which was said to be produced around the filesystem isn't produced.

Understanding that the execution time might be lengthy, I set set_time_limit(400) at first from the script.

Any tips about the way i could debug this? What is leading to the script to break in Apache, although not in cli?

after reading through all solutions and comments here, in my opinion that the script doesn't timeout.

i believe its an crash individuals application. the apache process runs inside a restricted user your cli doesn't.

you may be writing personal files to some folder, you don't have use of (underneath the apache user).

i can also be entirely possible that you will find php modules missing. compare you cli php.ini towards the apache php.ini.

switch on error logging:

error_log = /tmp/php_error.log
log_errors = 1

maybe you're in a test atmosphere you may even enable display_errors. but turn this always off being produced use!

see log why php aborts.

you should use the su command to operate the php script from cli inside the apache-account. this can be to inspections the privileges.

PHP CLI and PHP via Apache use different php.ini files. Look into the php.ini apply for the Apache version and ensure that max_execution_time is sufficient to accomodate your requirements.

You are able to execute phpinfo() to obtain the position of the presently-used php.ini file.

additional towards the php time period limit the cgi can timeout. if you work with mod_fcgid together with your apache you'll need may also increase time there.

have a look in to the manual

i want to improve FcgidIOTimeout 40

The ini file setting max_execution_time determines time PHP enables a script to operate:

The default setting is 30. When running PHP in the command line the default setting is .

The webserver may itself impose some limitations. Apache includes a Timeout directive. You might like to take a look at PHP error log plus Apache error log to find out which the first is the reason.