Reputation: 1929
I'm trying to run a PHP exec command. It runs like a charm in my CMD but it doesn't do anything when I try it via PHP. Can someone see what I'm doing wrong here.
Thanks.
<?php
//Command line command
//"C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" "C:\inetpub\wwwroot\dev_site\images\0000\thumbs.php"
//This runs perfectly fine.
echo "Command line execution started<br />";
//This is when $desination is already set to 0000
echo exec("C:\\Program Files (x86)\\PHP\\v5.3\\php-cgi.exe C:\\inetpub\\wwwroot\\dev_site\\images\\$destination\\thumbs.php");
echo "<br />Command line command successful";
//Does not run
?>
Upvotes: 1
Views: 3850
Reputation: 11
when you execute two or mor commands you must seperate them
try this:
echo exec("C:\\Program Files (x86)\\PHP\\v5.3\\php-cgi.exe", "C:\\inetpub\\wwwroot\\dev_site\\images\\$destination\\thumbs.php");
Upvotes: 1
Reputation: 1685
In Windows, exec() issues an internal call to "cmd /c your_command". This implies that your command must follow the rules imposed by cmd.exe which includes an extra set of quotes around the full command. Hope these links will be helpful
http://php.net/manual/en/function.exec.php
Upvotes: 1
Reputation: 52372
What's in your exec
call is not the same as what's in your comment as the command. You got rid of the sets of quotes around the command and its argument. They may have been important.
Upvotes: 6