Jump to content

PHP system() not responding correctly


BirdieUK

Recommended Posts

Hi,

I have a windows xp home edition computer running xampp and for some reason, the following programs will not work when called upon.

$command = "iexplore.exe www.google.com";
   system($command);
   $command2 = "C:\\xampp\\htdocs\\spotifyControl\\playpause.ahk";
   system($command2);

Both commands, when in command prompt, work perfectly... any ideas?? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/219720-php-system-not-responding-correctly/
Share on other sites

I've run into trouble with exec() on Windows before due to not having my quotes set up correctly.

 

for some reason when using exec() on windows with a path that has spaces in it, not only do you need to enclose the path itself in double quotes, but the entire exec'd command needs to be enclosed in double quotes as well. Try your call as:

 

$command = "\"iexplore.exe www.google.com\"";

 

or

 

$command = "\"iexplore.exe\" \"www.google.com\"";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.