I need to run series of PHP scripts and process tasks that are in queue. A task could take upto 10 minutes or more when running from PHP Cli or PHP/Apache. There could be multiple instances of the scripts. This needs to happen repeatedly. The PHP/Apache will have NO user interaction, they will be interacted with a backend /usr/bin/curl program.
I know that PHP-Cli will need to load the PHP interpreter and all its modules each time a script is run; whereas in PHP/Apache, they are loaded previously, so technically PHP/Apache should be a bit faster and consume lesser memory (as per other posts in SO)
Should I run these scripts via PHP CLI or via a dedicated Apache installed in the system just for background processing? So technically
# php processtask.php --taskId=1 &
# php processtask.php --taskId=2 &
VS
# /usr/bin/curl http://localhost/processtask.php?taskId=1 &
# /usr/bin/curl http://localhost/processtask.php?taskId=2 &
If loading curl each time could cause more resource usage then, I can use another daemon like script that loops and uses the curl library to do the same in different threads (this probably wont be PHP)