• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx

  • We are developing a new feature in Plesk that will help you promote your websites or business on social media. We want to conduct a one-hour online UX test to present the prototype and collect feedback. If you are interested in the feature, please book a meeting via this link.
    Thank you in advance!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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