Jump to content

Recommended Posts

This command line works in the windows run :

 

"e:\program.exe" "e:\test" /param10

 

It sends the folder test to the program.exe, program.exe converts files in the test folder.

 

How do you do such command with php?

 

The php script is in the same folder as the program.

<?php
exec('"program.exe" "test" /param10');
?>

 

It shows a white screen and don't work.

 

I tried

<?php
exec('hexEditor.exe');
?>

 

just to see if it opens up the hexeditor being in the same folder. but it doesn't and still a blank page.

 

 

Firstly, the programs aren't going to open any windows. Your server doesn't have permission to do that.

 

As for your other problem. php has a limited path set usually, so you will need to supply the full path to your .exe file to exec.

 

You might also try making use of exec()'s second and third arguments so you can at least try and get some feedback from your request.

I find it also important to note, if you use exec in a php script which is executed thru the command line, you'll recieve the output in the cmd window, but if you want to use exec anywhere like on ur web server, you'd want to use backticks or like thorpe said,  specify the output variable.

 

backticks r ` ` which is shorthand for exec and returns the value

 

$ping = `ping phpfreaks.com`;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.