views:

30

answers:

1

Hello,

One page on my web site is a PHP script that uses exec() to launch a separate PHP script which generates a PDF document.

The PDF may take 30 seconds to generate. When I hit the refresh button during this process, I am finding inconsistent behavior. On both my Mac and Windows local dev machines, refreshing the page will hang Apache. On my production Linux server, I don't seem to experience the problem.

Why is this? I don't care that my dev machines hang, I just want to be sure that it won't ever happen in production.

Thanks, Brian

A: 

Do you run exec() every time the page is rendered, or do you have some logic to check whether the previous php script has finished?

You may be generating a new PDF every time you refresh the page. If this takes a while, it might be hanging Apache because all the threads in its thread-pool are waiting for the exec'ed scripts to finish, if they're not detached properly.

If that is the case, it could certainly hang Apache on your production server.

Lethargy