How Can I execute Exe FIle Using PHP In Windows XP

Posted on 2008-02-06
Medium Priority
Last Modified: 2013-12-13
HI Everyone,
I am using WAMP. I want to Run An Exe File Which is Printing the document using PHP.
I have Used  exec("file.exe")
 but my browser got Hanged . No output given

Question by:dhavalbsolanki
  • 2
LVL 40

Expert Comment

by:Richard Quadling
ID: 20879750
The exec() command is taking place on the web server. Most likely, your web server service is set to NOT interact with the desktop.

So, PHP launches file.exe on the web server and doesn't show anything.

PHP is waiting for the application to finish before continuing itself.

The browser is way down the list of important things at this time.

So. Did you intend to execute file.exe on the web server (Oh - if you have access to the web server, take a look at the task manager to see if file.exe is running - once, twice, many many times?).

You can change the "Interact with the desktop" setting on the web server service.

If file.exe is expecting to interact with resources which are NOT on the local machine (file stores, remote printers, etc.) then localsystem will not be enough. You may need to change the user dealing with the web server service.


See if anything above makes sense and come back if you have more questions.

Expert Comment

ID: 20973783
exec ("del c:\\folder\\file.txt");

i love exec :)
LVL 40

Accepted Solution

Richard Quadling earned 200 total points
ID: 20974218

No exec() needed for many things.

Normally only need exec to deal with programs which have to PHP mechanism. But also, sometimes, it's just plain easier to use.

I use ImageMagick and a 1 line exec is equivalent to around 20 lines of PHP script.

No faster or better memory, but 1 line.

Author Closing Comment

ID: 31428432
Thanks for your comment I appreciate it

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question