Web lists-archives.com

Re: shell_exec causing empty server response/possible apache restart




Oh wow,

this was so in my face and I didn't even realize it. This makes complete sense. Thank you!

On Thu, May 16, 2019 at 10:35 AM Jose Nobile <jose.nobile@xxxxxxxxx> wrote:
Hello, 

It is because you are creating a new website, that means add a new virtual host in Apache, that means a graceful restart. The problem is not the PHP execution. 

A common approach ... Add the task of the website creation in a queue, and such queue is processed by a cronjob or similar. I recommend redis for the queue.

Regards,
José Nobile


On Thu, May 16, 2019 at 12:31 PM Justin Welenofsky <welenofsky@xxxxxxxxx> wrote:
Hello everyone,

I am having a really perplexing problem when trying to run shell_exec from a web page and it causing a empty response from server. I am trying to shell_exec a script that calls vesta commands that create new site/new database. I created a form/webpage that takes the new domain and DB info from a user and calls the bash script with shell_exec. It seems to fully run, creating the site and the database but server responds back with an empty response and the browser loses the connection to server. When I look at the apache error logs I reliably get

[Thu May 16 10:17:47.927392 2019] [mpm_prefork:notice] [pid 25471] AH00171: Graceful restart requested, doing restart
[Thu May 16 10:17:48.439378 2019] [:notice] [pid 25471] mod_ruid2/0.9.8 enabled
[Thu May 16 10:17:48.448382 2019] [mpm_prefork:notice] [pid 25471] AH00163: Apache/2.4.33 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.0h configured -- resuming normal operations

every single time I submit the form ( so I don’t think this is a normal log rotation ) and wondering how I can debug this further/find out why apache restarts when running this shell command via shell_exec (edited)

I have used remote debugging and it seems to get the output back from shell_exec and successfully stores it in variable and PHP script steps all the way way through till response. But immediately after shell_exec line runs I get the empty response from server and my browser loses its connection.
To debug I have tried running a PHP server with php -S addr:port and ssh tunnling the connection from the webserver to my computer so I can access the webpage and submit the form and that works just fine so I am guessing this may be an issue with apache?

My main question is does anyone know what may be causing this or even how I could do to debug this further?

Regards,
Justin Welenofsky