How Can I execute Exe FIle Using PHP In Windows XP

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
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.
exec ("del c:\\folder\\file.txt");

i love exec :)
Richard QuadlingSenior Software DeveloperCommented:

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dhavalbsolankiAuthor Commented:
Thanks for your comment I appreciate it
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.