p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: exec syntax for exe programs


Message #1 by mbergeron@e... on Wed, 25 Jul 2001 19:09:53
Hi!



I need to run an exe program inside my PHP page.

To run this program I do "addcours.exe c toto" in DOS.

All my dll's and exe are in the folder C:/WINNT/system32/

My php pages are in the folder C:/WEB/PHP/



Code of my PHP page :



...

exec("addcours.exe c toto");

...



But it doesn't work!!!



Why?



I wait for your advices!



Thanks,



Melanie
Message #2 by paul@d... on Wed, 25 Jul 2001 15:32:45 -0400
How about using the absolute path to the EXE?

exec("C:/WINNT/system32/addcours.exe c toto"); If the Web server can't get at the

directory, how about moving to EXE to a accessible directory?



mbergeron@e... wrote:



> Hi!

>

> I need to run an exe program inside my PHP page.

> To run this program I do "addcours.exe c toto" in DOS.

> All my dll's and exe are in the folder C:/WINNT/system32/

> My php pages are in the folder C:/WEB/PHP/

>

> Code of my PHP page :

>

> ..

> exec("addcours.exe c toto");

> ..

>

> But it doesn't work!!!

>

> Why?

>

> I wait for your advices!

>

> Thanks,

>

> Melanie



Message #3 by "James McGuire" <j.a.mcguire@b...> on Wed, 25 Jul 2001 20:43:27 +0100
because it doesn't know the path to the executable.



d'oh.



next time you call the program include the path in the quotes.



----- Original Message -----

From: <mbergeron@e...>

To: "beginning php" <beginning_php@p...>

Sent: Wednesday, July 25, 2001 7:09 PM

Subject: [beginning_php] exec syntax for exe programs





> Hi!

>

> I need to run an exe program inside my PHP page.

> To run this program I do "addcours.exe c toto" in DOS.

> All my dll's and exe are in the folder C:/WINNT/system32/

> My php pages are in the folder C:/WEB/PHP/

>

> Code of my PHP page :

>

> ...

> exec("addcours.exe c toto");

> ...

>

> But it doesn't work!!!

>

> Why?

>

> I wait for your advices!

>

> Thanks,

>

> Melanie



Message #4 by "Hermawan Haryanto" <hermawan@h...> on Wed, 25 Jul 2001 21:48:14
Helo there,

exec function did not result anything on your web browser, if you want the 

result to be displayed to the browser, do use PassThru function

Example of using exec() and PassThru:

$location="c:/winnt/system32/";

$application="addcours.exe c too";

$executed=$location.$application

//Exec

exec($executed);

//PassThru

PassThru($executed);



Almost the same but different function

Thanks

Hermawan Haryanto <hermawan@h...>





> Hi!

> 

> I need to run an exe program inside my PHP page.

> To run this program I do "addcours.exe c toto" in DOS.

> All my dll's and exe are in the folder C:/WINNT/system32/

> My php pages are in the folder C:/WEB/PHP/

> 

> Code of my PHP page :

> 

> ...

> exec("addcours.exe c toto");

> ...

> 

> But it doesn't work!!!

> 

> Why?

> 

> I wait for your advices!

> 

> Thanks,

> 

> Melanie

  Return to Index