Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP and Exec

Status
Not open for further replies.

jammer1221

Programmer
Jul 30, 2003
352
US
Hi All,

I'm running IIS 5.1 on Win XP Pro, PHP 5.1.4, and I have some questions about exec/system. I have given the proper permissions to cmd.exe so PHP can talk to it, but, I am having trouble with PHP actually talking to it.

I want to run a small batch file which launches a different application.

Here's my current code:
Code:
$convert=exec("cmd C:\\start.bat");
if ($convert) echo "File was successfully converted";
else echo "File failed to convert";

I've also tried variants of this:
Code:
exec("start 'mpeg' 'C:\\ffmpeg\\ffmpeg.exe -i C:\\Inetpub\\[URL unfurl="true"]wwwroot\\ffmpeg\\video.mpeg[/URL] C:\\testofsonversion.swf'");

Any help is greatly appreciated!

Thanks,
Matt Powell
 
Hi Everyone,

So, I figured it out. I thought I set the right permissions but I didn't. I wanted to kind of say what I did to get this working incase anyone else stumbles on this thread.

1) Give IUSR_COMPUTERNAME Read and execute permissions to C:\windows\system32\cmd.exe (Or whatever your system root is)
2) Give IUSR_COMPUTERNAME Read and execute permissions to the batch or .exe file needed to be called
3) Since I'm running IIS I needed to configure my website to allow scripts and executables
These next two I'm not sure how important they are, but, I'll write them down anyway...
4) In IIS, set application protection to low
5) Allow the World Wide Web Publishing service to "Interact with desktop" under the logon tab.

HTH,
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top