473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

exec background process

I want have PHP call another process (another PHP script at the moment
but it may end up being a binary) in the background and not wait for
process to complete, but rather instantly jump the the next line of
code.

I've tried things like:

exec("./script.php &"); // script.php has executable permissions set
exec("at -f ./script.php now"); // and #!/usr/bin/php at the top of
the code

Neither seem to work. They both execute script.php, but both hang
around until script.php has completed.

Any ideas?
Jul 16 '05 #1
1 16988
Matt <go****@mralston.com> wrote:
I want have PHP call another process (another PHP script at the moment
but it may end up being a binary) in the background and not wait for
process to complete, but rather instantly jump the the next line of
code.

I've tried things like:

exec("./script.php &"); // script.php has executable permissions set
exec("at -f ./script.php now"); // and #!/usr/bin/php at the top of
the code

Neither seem to work. They both execute script.php, but both hang
around until script.php has completed.


Hi Matt,

You could use proc_open for this:

proc_close(proc_open ("./script.php &", array(), $foo));

The empty array for the output specs prevents opening any pipes to the new
process, so proc_open doesn't wait for the execution of script.php to
finish - the last parameter is just there because it has to be.
proc_close() closes the process immediately, so your PHP script doesn't
stop.

HTH;
JOn
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: pokémon | last post by:
Ok, I want to implmement a "backgound process", but the catch is this: I want to control it via a Web Service, that is to say, the Web Service will be its API. What type of application should...
1
by: memento | last post by:
Hi, I am wondering how to do automatic ASP background process to generate every few minutes statistics from DataBase? I.e. how many people are already registered... or how many people were born in...
4
by: Mrinal Kamboj | last post by:
Hi , Doubt may be bit trivial , but i wanted to know , what are the exact benefits derived while we run a background process as an NT service in windows , we can as well achieve the...
6
by: cricketunes | last post by:
Hi Folks, I use PHP for a user login application and it works fine. The problem is that another process should start up as soon as the user logs in and should keep on displaying different popup...
4
by: Shailesh Humbad | last post by:
I was trying to exec a background process on XP using PHP CLI, but could not get it to work. Suppose the command I want to spawn off is "cmd". On *nix, it is as easy as putting ampersand "&" at...
1
by: hsmcdonald | last post by:
Hello all, I have a mail function that sends parsed information to an employee distribution list. I was trying to setup a process where the admin can initiate a letter to this list, and...
8
by: Ravi | last post by:
Hi to all, There is a start button in my page. if user clicks on that then a php program should start and should listen on a particular port. and also user should able to do other tasks on...
20
by: Alexey Kulentsov | last post by:
Hi all! Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll) I need to run background process and see output but for current moment all methods runs it as process not as...
1
by: kamlesh20J | last post by:
hi , i have flash screen showing video file and same time process is running in background to interact and open the device but when process is running then flash screen hang and video not showing.i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.