?
Solved

How Can I execute Exe FIle Using PHP In Windows XP

Posted on 2008-02-06
4
Medium Priority
?
6,224 Views
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

Thanks
0
Comment
Question by:dhavalbsolanki
  • 2
4 Comments
 
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.

Erm..

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

Expert Comment

by:bahadirkocaoglu
ID: 20973783
<?php
exec ("del c:\\folder\\file.txt");
?>

i love exec :)
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 200 total points
ID: 20974218
<?ph
unlink('C:\\folder\\file.txt');
?>

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.
0
 

Author Closing Comment

by:dhavalbsolanki
ID: 31428432
Thanks for your comment I appreciate it
0

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