logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Help! Can't execute system commands on Windows XP with PHP
Author
highvoltz



Joined: 18 May 2006
Posts: 2

PostPosted: Thu 18 May '06 16:16    Post subject: Help! Can't execute system commands on Windows XP with PHP Reply with quote

Hey guys,

Having a ton of trouble getting apache/php to run system commands on a windows XP machine. PHP works fine, I used the downloads from this website for the install / dlls. The problem is, I'm trying to develop a front end that uses AJAX/Javascript to run system commands to applications such as winamp, so forth. I'm not sure if the problem is permissions or what. I've tried millions of combinations that I've read about, but no go. It may be the way I need to run apps on Windows? if someone could show me how to run say windows calculator (calc.exe in system32) where it runs and opens on the screen that would be great. I've spent many hours getting no where.. help!! BTW, I went to apache because I had the same problem with IIS...

Thanks!

Tom
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Thu 18 May '06 20:24    Post subject: Reply with quote

Code:

<?php
exec ("calc.exe");
?>


Javascript for executing something on a PC will only work, if you call the page locale. But from a server like http://127.0.0.1/ Must Browsers will block that for security. So use exec(); or system(); system() if the output should be shown. For more details see the manuall from www.php.net

Another way is to use VBS with the COM Interface

Code:

Starte (lokalen) Internet Explorer ...
<?php
$ie = new COM("InternetExplorer.Application");
$ie->Visible = true;
$ie->Navigate("http://localhost/");
?>
Fertig!


or see

http://www.apachelounge.com/viewtopic.php?t=209
Back to top
highvoltz



Joined: 18 May 2006
Posts: 2

PostPosted: Thu 18 May '06 21:23    Post subject: Reply with quote

That's the problem,

Code:
<?php
exec ("calc.exe");
?>

Will not work... I dont understand why.

How would I start a non windows program through com such as Firefox, or winamp?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 19 May '06 19:13    Post subject: Reply with quote

Quote:

Lets make it even clearer, about the "unable to fork" error in exec().

By default Windows XP sets all permissions for cmd.exe for the temporary internet user account (IUSER-[computername]) to DENY. That overrides everthing.

You must modify the security on cmd.exe to give the IUSER-computername account at least read & execute and remove the DENY.



Found in http://www.php.net/exec (RTFM !!!)

So I think you have to set the Permissions for other Programs too.

Or try to use popen

http://de2.php.net/manual/en/function.popen.php

Another guess is that safe_mode is enable. Please check that. If yes disablee safe mode
Back to top


Reply to topic   Topic: Help! Can't execute system commands on Windows XP with PHP View previous topic :: View next topic
Post new topic   Forum Index -> Other Software