473,434 Members | 1,829 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,434 software developers and data experts.

EXEC() Runs process in background

Exec, shell_exec, system, popen functions all run the process in the
background.
how can i get it to run the process normally.
my code looks like this:
<?
exec("batch_file.bat");
?>

am i doing anything wrong?

thanks

Jan 17 '06 #1
13 4384
On 17 Jan 2006 15:16:52 -0800, gi*******@gmail.com wrote:
Exec, shell_exec, system, popen functions all run the process in the
background.
They don't normally, unless you do something fairly specific to get them to.
how can i get it to run the process normally.
my code looks like this:
<?
exec("batch_file.bat");
?>

am i doing anything wrong?


What's in batch_file.bat?

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 18 '06 #2
gi*******@gmail.com wrote:
Exec, shell_exec, system, popen functions all run the process in the
background.


What do you mean?

What would you like to happen
and what happens instead?

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 18 '06 #3
Pedro Graca wrote:
gi*******@gmail.com wrote:
Exec, shell_exec, system, popen functions all run the process in the
background.


What do you mean?

What would you like to happen
and what happens instead?


I think he/she wants this to run synchronously as opposed to
asynchronously? (so it will execute, wait for it to finish, then come back
to the php script?

Maybe there is some file being created by the shell script/program??

--
a beef jerky site http://www.choicebeefjerky.com.au
not a beef jerky site http://mycoolwheels.com/vote.cmks
most midwives do not have children
Jan 18 '06 #4
my batch file (batch_file.bat) starts ms access.
it works fine when i open it by double clicking the file.
the batch file code:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"

when i run the php script:
<?
exec("batch_file.bat");
?>

i notice the 3 proccess' : php-cgi.exe , cmd.exe, and MSACCESS.EXE all
running under IUSER in the task manager, but i cant see any of them.
the php site itself will not stop searching for the site until it times
out, or until i manually end the proccess through the task manager.
any ideas?

Jan 18 '06 #5
giloosh, please read <http://cfaj.freeshell.org/google>
before you post again. Thank you.

giloosh wrote:
my batch file (batch_file.bat) starts ms access.
it works fine when i open it by double clicking the file.
the batch file code:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"

when i run the php script:
<?
exec("batch_file.bat");
?>

i notice the 3 proccess' : php-cgi.exe , cmd.exe, and MSACCESS.EXE all
running under IUSER in the task manager, but i cant see any of them.
the php site itself will not stop searching for the site until it times
out, or until i manually end the proccess through the task manager.
any ideas?


Lets imagine the webserver is in 'IT' department.
Someone in the 'Accounting' department accesses your site.

Can you explain to me why you would like somebody in 'Accounting' to run
MSACCESS.EXE on the webserver?

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 18 '06 #6
Hello pedro,
thanks for your kind reply.
i want to call ms access to run some special functions through a
webpage. kind of like a remote control, without really connecting to
the server remotely.

Jan 18 '06 #7
giloosh wrote:
my batch file (batch_file.bat) starts ms access.
it works fine when i open it by double clicking the file.


How long (ie how many seconds) does ms access stay open when you double
click it?

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 18 '06 #8
Pedro,
when i double click the batch file it opens a macro within MS access
which calls a function and then tells access to quit.
this is how i use the batch file to run the macro:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"C:\ACCESS_FILE.mdb" /x "my_macro"

this all happens within 1 sec or 2.
Pedro Graca wrote:
giloosh wrote:
my batch file (batch_file.bat) starts ms access.
it works fine when i open it by double clicking the file.


How long (ie how many seconds) does ms access stay open when you double
click it?

--
If you're posting through Google read <http://cfaj.freeshell.org/google>


Jan 18 '06 #9
giloosh top-posted:
Pedro Graca wrote:
giloosh wrote:
> my batch file (batch_file.bat) starts ms access.
> it works fine when i open it by double clicking the file.


How long (ie how many seconds) does ms access stay open when you double
click it?

when i double click the batch file it opens a macro within MS access
which calls a function and then tells access to quit.

this all happens within 1 sec or 2.


Can you try to run that batch file as the user your webserver runs
under? Something like right-click and "Run as different user" ... I
can't remember exactly how to do it; you'll have to experiment.

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 19 '06 #10
On Tue, 17 Jan 2006 23:56:47 +0000, Andy Hassall wrote:
On 17 Jan 2006 15:16:52 -0800, gi*******@gmail.com wrote:
Exec, shell_exec, system, popen functions all run the process in the
background.


They don't normally, unless you do something fairly specific to get them to.
how can i get it to run the process normally.
my code looks like this:
<?
exec("batch_file.bat");
?>

am i doing anything wrong?


What's in batch_file.bat?

I think your problem is MS Access is forking and running in the
background, causing the BAT to exit.

Open up a command window and run your bat file in it. How long before your
BAT exits and goes back to the command prompt? If the answer is "before I
close MS Access", then there's nothing you can do about it.

-Rob

Jan 19 '06 #11
"Robin Haswell" <ro*@digital-crocus.com> wrote in message
news:pa****************************@digital-crocus.com...
On Tue, 17 Jan 2006 23:56:47 +0000, Andy Hassall wrote:
On 17 Jan 2006 15:16:52 -0800, gi*******@gmail.com wrote:
Exec, shell_exec, system, popen functions all run the process in the
background.
They don't normally, unless you do something fairly specific to get them
to.
how can i get it to run the process normally.
my code looks like this:
<?
exec("batch_file.bat");
?>

am i doing anything wrong?


What's in batch_file.bat?

I think your problem is MS Access is forking and running in the
background, causing the BAT to exit.

do a start, run, cmd to get a cmd shell.
type in start /?
and look at your options. I think you can get the batch file to wait for
the process to finish before continuing.
and BTW, use .CMD instead of .BAT - it will give you these options. I can't
remember if .BAT files bring up command.com rather than cmd.exe. I think
they do. that is, if you are on an NT/2000/xp box. .CMD files will also
give you long filenames by default, and a bunch of extra commands and
switches. try doing a set /? and watch the fireworks. batch files can loop
and count and do calculations with CMD. (I'm sure this won't impress the
UNIX folk :-) )


Open up a command window and run your bat file in it. How long before your
BAT exits and goes back to the command prompt? If the answer is "before I
close MS Access", then there's nothing you can do about it.

-Rob

Jan 21 '06 #12

"Jim Michaels" <jm******@yahoo.com> wrote in message
news:uJ******************************@comcast.com. ..
"Robin Haswell" <ro*@digital-crocus.com> wrote in message
news:pa****************************@digital-crocus.com...
On Tue, 17 Jan 2006 23:56:47 +0000, Andy Hassall wrote:
On 17 Jan 2006 15:16:52 -0800, gi*******@gmail.com wrote:

Exec, shell_exec, system, popen functions all run the process in the
background.

They don't normally, unless you do something fairly specific to get
them to.

how can i get it to run the process normally.
my code looks like this:
<?
exec("batch_file.bat");
?>

am i doing anything wrong?

What's in batch_file.bat?

I think your problem is MS Access is forking and running in the
background, causing the BAT to exit.

do a start, run, cmd to get a cmd shell.
type in start /?
and look at your options. I think you can get the batch file to wait for
the process to finish before continuing.
and BTW, use .CMD instead of .BAT - it will give you these options. I
can't remember if .BAT files bring up command.com rather than cmd.exe. I
think they do. that is, if you are on an NT/2000/xp box. .CMD files will
also give you long filenames by default, and a bunch of extra commands and
switches. try doing a set /? and watch the fireworks. batch files can
loop and count and do calculations with CMD. (I'm sure this won't impress
the UNIX folk :-) )


try
start /wait somefile.mdb /x somemacro
in your .cmd file. it might also work in your .BAT file.


Open up a command window and run your bat file in it. How long before
your
BAT exits and goes back to the command prompt? If the answer is "before I
close MS Access", then there's nothing you can do about it.

-Rob


Jan 21 '06 #13

<--quote
I think your problem is MS Access is forking and running in the
background, causing the BAT to exit.

Open up a command window and run your bat file in it. How long before
your
BAT exits and goes back to the command prompt? If the answer is "before
I
close MS Access", then there's nothing you can do about it.
quote-->

ms access closes before the cmd promt closes when i run the bat file
manually.
it also runs when i run the .bat file through start>run>cmd shell. so
that is not the problem
this is obviously not a ms access issue. no matter what file i try to
run in php, it always runs in the background and never closes untill i
end the proccess through the task manager.
i am using windows xp pro if that makes any diff at all?

Jan 23 '06 #14

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

Similar topics

4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: Matt | last post by:
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...
1
by: Hal Vaughan | last post by:
I've been using Runtime.exec() like this: Runtime rt = Runtime.getRuntime(); try {Process p = rt.exec("MyCommand.bat");} catch (Exception e) {do stuff} When I start my Java classes, I start...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
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...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
4
by: vol30w60 | last post by:
Hi folks, I am trying to launch a program with PHP code. I am running Apache on Windows XP SP2. I am using the method noted here: http://us2.php.net/manual/en/function.exec.php#59428 To...
8
by: r0g | last post by:
Hi There, I'm trying to migrate a locally hosted page from windows to a private Ubuntu development server and one of the key bits of functionality (which used to work fine in Windows) was the...
3
by: Shayco | last post by:
hey, in my code i'm using Runtime.getRuntime().exec() in order to run a .bat file that calls another java program (they communicate with each other using RMI). when i call: Process process =...
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
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.