Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing a 504 Gateway Timeout with huge PHP script

I'm currently running an Apache server (2.2) on my local machine (Windows) which I'm using to run some PHP scripts to take care of some tedious work. One of the scripts involves a ton of moving, resizing, and download / uploading files to another server. I would very much like the script to run constantly so that I don't have to baby the script by starting it up again every time it times out.

set_time_limit(0);
ignore_user_abort(1);

Both are set in my script, but after about 30mins to an hour the script stops and I get the 504 Gateway Time-out message in my browser. Is there something I missing in Apache or PHP to prevent the timeout? Or should I be running the script a different way?

like image 700
tsp3 Avatar asked Dec 05 '22 01:12

tsp3


1 Answers

Or should I be running the script a different way?

Definitely. You should run your script from command line (CLI)

like image 146
dev-null-dweller Avatar answered Dec 11 '22 10:12

dev-null-dweller