ubuntu - Running multiple system commands in background via php system() command? -


I want to open a URL and call a script on my server. It takes a long time to execute the script, so I want to run it in the background so there is no need to worry about opening the browser and ending time.

It seems that the PHP function system () should work, but this is not working for me.

The script should be implemented from inside the correct directory so that all the relative paths are correct. Here is the system command I would like to execute:

  cd / path / to / script / directory /; Php my_php_script & amp;  

And this is the latest thing that I have not had any advantage

  system ('(cd / path / to / script / directory /; php my_php_script & Amp;; / / / dev / null););  

How does anyone know this?

It is very easy to do a system like Unix, like Linux, that is the Nohuh command you have to start with , And continue to run the following commands. If the script exits or a user logs out then the command will also run. It's similar to your command, but it's easy to read.

  system ("nohup php / path / to / script / directory / my_php_script '/ dev / null & amp;  

PHP garbage collector memory leaks There is a possibility to do and a simple script can eat gigabytes of memory in case of day. It is better to schedule php scripts to run in the form of cron jobs that get out in hours or minutes to free up memory .


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -