Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using wamp on a windows machine and just wanted to invoke an exe on this via a php web page. When I am launching the php from commandline on server its working fine but when invoke same php via browser from other machine it does not work and waits forever. My php file is like this

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

When I access this from client (http://servername/exec.php) it waits forever. I know its a permission issue with apache on windows, but not sure how to fix this.

share|improve this question

closed as off-topic by Tom O'Connor Aug 14 '13 at 21:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Do your error logs have anything interesting to say ? –  Iain Jan 11 '12 at 10:05
add comment

1 Answer

It won't work.

As you are running Apache as a Windows service, which runs on different logon session, it will not show the application windows. Also, the application will run on the webserver system only and not on the system where you are accessing the php file through browser.

As the calculator application is waiting for user input, the php file is loading forever in your system.

You can initiate console based applications using "exec" function.

share|improve this answer
    
That doesn't seem to hold true - I have Apache setup as a service (with XAMPP) on Windows 7, and can launch 'calc.exe' without any issue via PHP run from my browser. –  cyberx86 Jan 11 '12 at 11:17
    
Thanks, Yes it clears many things. By "console based" applications did you meant that I can initiate any batch script via exec which in-turn do some other stuffs? If that's possible that would be great! I have tried running a batch script via exec on server but again i am seeing same forever wait. –  Anindya Sharma Jan 11 '12 at 11:30
    
Yes, you can run a batch script. But the batch script should not start any console based application. –  Aravind Jan 11 '12 at 12:21
    
@cyberx86 I am also running Apache as a service (via net start wampapache) , but its not working for me. I have also made the service log on as an administrator account. –  Anindya Sharma Jan 11 '12 at 13:00
1  
The service won't start any console based application. If you are running a service in local system account, you can enable "Allow service to interact with desktop" option to start the application in desktop. But, it will start at the system at where the webserver service is running. –  Aravind Jan 11 '12 at 13:45
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.