• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Apache gone down after executing script

Nicola

Basic Pleskian
Hi,
I have a function in php that import a dump sql in a database: I'm using this command
PHP:
shell_exec ( "mysqldump -h localhost -u $username -p$password $databaseName | mysql -h localhost -u $username -p$password $databaseName &> /dev/null &" )

If the command run for more then 30 seconds, apache gone away and all sites on the server become inaccessible: I need to restart the php service to restore the functioning.

max_execution_time is set to 300 but nothing changes.

Someone has an idea?

Thanks
 
What sort of related errors do you have in Apache error log?
 
In "error_log" there are no errors, I only can not access via browser (image in attachment). The command is launched via an ajax request
 

Attachments

  • Cattura.JPG
    Cattura.JPG
    24.3 KB · Views: 3
Nginx is not receiving the process result from backend Apache within 30 seconds timeout. See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout for details on that setting.

To avoid having to reconfigure Nginx for your site, I suggest to change the code of the website and to call the shell_exec command asynchronously, then periodically check on the results. The reason for that is that no setting, whatever you do, will make sure that this error won't occur again. For instance if you set the prox_read_timeout of Nginx to an extremely long time period of 600 seconds (10 minutes) and your dump runs 601 seconds, the error will occur again. You will never know, how long it takes the host to complete the shell_exec command, so you can never be sure whether the timeout occurs.
 
Back
Top