473,403 Members | 2,284 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,403 software developers and data experts.

Shelling without waiting

In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?

The program I want to run is a perl script that takes data stored by
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind along till
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?

Any ideas, weblinks, documentation is appreciated

Bill H
Sep 5 '08 #1
8 1981
On Fri, 05 Sep 2008 04:28:16 -0700, Bill H wrote:
Looking at exec() and system() these would all seem to wait for
the external program to complete before they came back. Is there a way
of doing this without waiting for the results?
May you can do a fork() before doing an exec().
Sep 5 '08 #2
On 5 Sep, 12:28, Bill H <b...@ts1000.uswrote:
In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?

The program I want to run is a perl script that takes data stored by
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind along till
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?

Any ideas, weblinks, documentation is appreciated

Bill H
<?php
$started=`at now script.pl $arg`;
?>

C.
Sep 5 '08 #3
On 5 Sep, 13:46, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 5 Sep, 12:28, Bill H <b...@ts1000.uswrote:


In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?
The program I want to run is a perl script that takes data stored by
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind along till
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?
Any ideas, weblinks, documentation is appreciated
Bill H

<?php
* $started=`at now script.pl $arg`;
?>

C
That is the equivalent of shell_exec and it will still await the
completion of the command.
Sep 5 '08 #4
On Sep 5, 8:21*am, Sjoerd <sjoer...@gmail.comwrote:
On Fri, 05 Sep 2008 04:28:16 -0700, Bill H wrote:
Looking at exec() and system() these would all seem to wait for
the external program to complete before they came back. Is there a way
of doing this without waiting for the results?

May you can do a fork() before doing an exec().
I thought of this Sjoerd, but it doesn't seem to be what I am looking
for. A solution I thought of, but it isn't elegant, is to shell_exec()
an intemediatary perl program that would then start up the real script
in the background. The intemediatary program would return immediately
to php once it started the other one. But this seems to be too much of
a kludge.

Bill H
Sep 5 '08 #5
Bill H wrote:
In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish.
resource popen ( string command, string mode )
Opens a pipe to a process executed by forking the command given by command.
Sep 5 '08 #6
On 5 Sep, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 5 Sep, 13:46, "C. (http://symcbean.blogspot.com/)"

<colin.mckin...@gmail.comwrote:
On 5 Sep, 12:28, Bill H <b...@ts1000.uswrote:
In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?
The program I want to run is a perl script that takes data stored by
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind along till
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?
Any ideas, weblinks, documentation is appreciated
Bill H
<?php
$started=`at now script.pl $arg`;
?>
C

That is the equivalent of shell_exec and it will still await the
completion of the command.
No it won't: read it again.

C.
Sep 6 '08 #7
On Sep 6, 12:40*pm, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 5 Sep, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 5 Sep, 13:46, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 5 Sep, 12:28, Bill H <b...@ts1000.uswrote:
In a php script I am using I need to call an external program and have
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?
The program I want to run is a perl script that takes data stored by
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind along till
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?
Any ideas, weblinks, documentation is appreciated
Bill H
<?php
* $started=`at now script.pl $arg`;
?>
C
That is the equivalent of shell_exec and it will still await the
completion of the command.

No it won't: read it again.

C.
shell_exec — Execute command via shell and return the complete output
as a string

How can the complete output be returned if it does not await the
completion of the command?
Sep 6 '08 #8
On 6 Sep, 12:48, Captain Paralytic <paul_laut...@yahoo.comwrote:
On Sep 6, 12:40 pm, "C. (http://symcbean.blogspot.com/)"

<colin.mckin...@gmail.comwrote:
On 5 Sep, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 5 Sep, 13:46, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 5 Sep, 12:28, Bill H <b...@ts1000.uswrote:
In a php script I am using I need to call an external program andhave
it start running, but I don't want the php script to wait for it to
finish. Looking at exec() and system() these would all seem to wait
for the external program to complete before they came back. Is there a
way of doing this without waiting for the results?
The program I want to run is a perl script that takes data storedby
the php program and then creates pdf's and preview images of these.
Instead of the php (and user) waiting the 15 seconds or more for this
to happen, I want to call this external program and then let the user
(via flash and php) poll the server to see if it is done. When I was
doing this in perl alone I was able to flush out the results of the
flash post back to flash and then the perl could just grind alongtill
it was done, is this a possible scenario in php (though I would prefer
the 1st scenerio of starting the external program and leaving)?
Any ideas, weblinks, documentation is appreciated
Bill H
<?php
$started=`at now script.pl $arg`;
?>
C
That is the equivalent of shell_exec and it will still await the
completion of the command.
No it won't: read it again.
C.

shell_exec — Execute command via shell and return the complete output
as a string

How can the complete output be returned if it does not await the
completion of the command?
man at

C.
Sep 8 '08 #9

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

Similar topics

29
by: Paul L. Du Bois | last post by:
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found...
5
by: Johnsy Joseph | last post by:
Hello Everybody, I am trying to write a program that reads a single character, but I always need to press the enter key too. Is there any way to read just a single character without waiting for...
1
by: A | last post by:
Does anyone have any code for shelling out a command to start up an executable with command line arguments? I am simply trying to start a MSDE install by calling its Setup.exe. Thanks
3
by: sam | last post by:
Im trying to shell a simple console application from an ASP.NET web form. I use the vb command: Shell(sShellPath, AppWinStyle.NormalFocus, True) It executes the line of code without any errors...
1
by: Stephen Miller | last post by:
On my development machine (where the group 'Everyone' has full access to every directory), the following code successfully shells to a console application: Dim objShell As...
3
by: _IS_ - | last post by:
I have the problem that shelling in vb.net is not working for me at this point. I am trying to make a graphical application to netsend (multiple) PCs on the network(notwork) and to ping to check...
6
by: djc | last post by:
I'm wondering what options are available, if any, for being able to run 'any command line command' from a .net compiled program. I would want the output that would normally go to the command line...
0
by: MirkoGeest | last post by:
(Webmaster: sorry, I posted this first at the General Software Engineering category, but I think this goes here) I'm using Visual Basic with Web Forms on .NET 2003 and I'm experiencing a very...
10
by: Michele Simionato | last post by:
I have always been curious about how people implement mainloops (or, in Twisted terminology, reactors). So I sit down and I wrote the following simple implementation: import itertools class...
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.