I have an upload script that uploads images to a server. I need a script to run in the background after the image is uploaded and moved by move_uploaded_file(), but I need to send a filename and path to that file to the script (pretty much send some data).
How can I run a PHP script in the background after some data has been sent to it?
Notes: The files are uploaded via XMLHttpRequest.
First read this
php exec command (or similar) to not wait for result
It is basically pointing out that you need to create a script that takes two params (
filename, path)
Then you need to use the exec function
Edit:
As pointed out by Brent Baisle in the comments below, "nohup" must be added infront of the script to execute independently (with a different parent pid)
This writes the output to dev/null, php should not block at this point, i have not tried, but in theory.