Re: [PHP] About exec function

2007-03-14 Thread Richard Lynch
The PHP User probably does not have write access to the new .out file
it just created.

Why Windows would be this weird, and let you create a file you cannot
write to is beyond my comprehension, but there it is...

If it's a multi-user Windows box, try logging in as the user PHP runs
as, which is IUSER_machinename, I think, on some Windows boxes...

exec() also takes 2 more arguments, which pass back output and error
code.

If Windows is giving any kind of error message and or OS error code,
you can get them by using those 2 args.

Do this first, actually, as it is better than just guessing what went
wrong.

On Tue, March 13, 2007 6:14 am, Pablo Luque wrote:
 Hello, I'm designing a website with php and the critical point of the
 design
 is to execute a program in the server, so after execution is finished,
 server will show the client some data and info.
 The program is called pspice, which analizes electronic circuits,
 works in
 msdos and in order to call him you need to write in the command the
 input
 file (which is created before we call the program) and the output
 file,
 which can have the same name as the input file, since they have a
 different
 extension. If everything works correctly after the execution of the
 proper
 command, a .out (the output file written in the command) file should
 be
 created with the data the server would later provide to the client.
 I have got to execute the program using the line:

 exec('c:\WINDOWS\\SYSTEM32\\cmd.exe /c start
 c:\\PHP\\PSPICE\\pspice1.exe
 ej1 ej1')

 The problem I have is that the execution never ends. The cmd window
 with the
 execution of the program appears and never ends, just keep simulating
 (and
 the execution should be over in less than a second). The .out file is
 created but it is empty. How can I make the execution of the program
 stop
 and continue executing the rest of the code of my php file?

 Thanks!

 _
 Descubre la descarga digital con MSN Music. Más de un millón de
 canciones.
 http://music.msn.es/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] About exec function

2007-03-13 Thread Jochem Maas
Pablo Luque wrote:
 Hello, I'm designing a website with php and the critical point of the
 design is to execute a program in the server, so after execution is
 finished, server will show the client some data and info.
 The program is called pspice, which analizes electronic circuits, works
 in msdos and in order to call him you need to write in the command the
 input file (which is created before we call the program) and the output
 file, which can have the same name as the input file, since they have a
 different extension. If everything works correctly after the execution
 of the proper command, a .out (the output file written in the command)
 file should be created with the data the server would later provide to
 the client.
 I have got to execute the program using the line:
 
 exec('c:\WINDOWS\\SYSTEM32\\cmd.exe /c start
 c:\\PHP\\PSPICE\\pspice1.exe ej1 ej1')
 
 The problem I have is that the execution never ends. The cmd window with
 the execution of the program appears and never ends, just keep
 simulating (and the execution should be over in less than a second). The
 .out file is created but it is empty. How can I make the execution of
 the program stop and continue executing the rest of the code of my php
 file?

exec() will block until you command finishes - which it never does,
this is not a problem with exec() or php but rather with the cmdline
app you are calling - or more likely due to the way you are calling the
cmdline in your example.

I'm guessing it should be this instead (if it's not then it's time for you to
read the cmd.exe and/or start.exe man pages :-) :

exec('c:\WINDOWS\\SYSTEM32\\cmd.exe /c c:\\PHP\\PSPICE\\pspice1.exe ej1 ej1');



 
 Thanks!
 
 _
 Descubre la descarga digital con MSN Music. Más de un millón de
 canciones. http://music.msn.es/
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php