I have a working php script using shell_exec to execute an external program that take about 30 seconds to complete. Problem is that if an user close the browser or the connection is closed for some reason the program executed with shell_exec continue to run for nothing, since it's output can't be sent to the user anymore.
Is there a way to kill this process as soon as the connection is closed?
Thank you for your help.