Hi,
I am trying to call an application from php. I have tried exec() and
system() and even popen() all to no avail.
Can an application be called if it brings up a window? The app I am
calling has a command line interface, but it insists on bringing up
it's standard window also.
At the moment the .exe file displays in Windows Task Manager in the
Processes tab.
The PHP script hangs (until timeout) and the .exe doesn't do the job it
should.
I am probably being daft :o)
Thanks in advance for any help or tips,
Mike Youell. 4 2168
Maybe this passage in the exec() manual contains your answer?
Note: If you start a program using this function and want to leave it
running in the background, you have to make sure that the output of
that program is redirected to a file or some other output stream or
else PHP will hang until the execution of the program ends.
Mike Youell wrote: Hi,
I am trying to call an application from php. I have tried exec() and system() and even popen() all to no avail.
Can an application be called if it brings up a window? The app I am calling has a command line interface, but it insists on bringing up it's standard window also.
At the moment the .exe file displays in Windows Task Manager in the Processes tab.
The PHP script hangs (until timeout) and the .exe doesn't do the job it should.
I am probably being daft :o)
Thanks in advance for any help or tips, Mike Youell.
Mike Youell wrote: Hi,
I am trying to call an application from php. I have tried exec() and system() and even popen() all to no avail.
Can an application be called if it brings up a window? The app I am calling has a command line interface, but it insists on bringing up it's standard window also.
At the moment the .exe file displays in Windows Task Manager in the Processes tab.
The PHP script hangs (until timeout) and the .exe doesn't do the job it should.
I am probably being daft :o)
Thanks in advance for any help or tips, Mike Youell.
PHP executes in context of IIS (or other webserver), that means it has
less privileges and usually cannot interact with the desktop.
IIS has settings in Control Panel -> Administration Tools -> Services ->
World Wide Web Publishing -> Log On tab -> Allow service to interract
wiht desktop.
HTH
Roman
Hi Gerry,
Thanks for your help.
I piped the output to NUL and later to a file but it still didn't work.
I think it's an XP problem, probably to do with permissions or
something, but no log file info so it's just complete guess work.
I tried everything suggested on news groups (going back a few years)
and on websites, and asked a highly experienced friend yet nothing
worked.
So in the end I created a listener "process" (actually a 15 line DOS
batch file for now) external to PHP which listens for system events
triggered by PHP, i.e. PHP creates a file which the listener process
uses to call the relevant application. The file is deleted once
processed by the listening batch file.
I've put some simple handshaking in there so PHP can talk to the
listener process.
Anyway I've sorted it. Not perfect but then what is ;o)
Again, thanks for your help :o)
Mike Youell.
Thanks Roman. I'm using Apache so not sure what to do about
permissions, or whether it is to do with permissions?
I'm also a bit nervous to reduce permissions anyway. The system I
created (see above) I believe to be more secure as it only allows
specific executables to be called with certain arguments only, and it
doesn't relax any permissions, which makes it a little bit easier to
sleep at night :o)
Thanks,
Mike. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul |
last post by:
Hi,
In SQL Books Online in the section on @@Error it gives the following
example:
-- Execute the INSERT statement.
INSERT INTO authors
(au_id, au_lname, au_fname, phone, address,
city, state, zip, contract) values
(@au_id,@au_lname,@au_fname,@phone,@address,
|
by: Alex |
last post by:
Hi
I have an external assembly which I call from a windows forms
application. What I want to do is terminate the calling application
from within the assemnly - or otherwise ensure that the calling
application has terminated before the code in the assembly starts
executing. Anyone know how I would do this?
Thanks
Alex.
|
by: Dominique Vandensteen |
last post by:
I want to get the icon from my application exe file
dim myIcon as Icon = ... -> "myApplication.exe,0"
how can I do that?
|
by: ASP Developer |
last post by:
I would like to be able to set my connection strings and other settings in my
class library. Then when a calling application calls my library I can use
those settings to query my database etc. However, for some reason I can only
get the configuration settings of the calling application vs the settings in
the library. Any help would be greatly appreciated.
|
by: rini |
last post by:
Using the Shell command I am calling an exe generated from matlab. The black console appears but for a moment only.I am not being able to see the output.How this problem can be solved? Please help.Thank you.
| |
by: Lee Crabtree |
last post by:
I remember when I was first getting into .NET Forms programming that
there was a rather emphatic rule about not constructing a form before
calling Application.Run with it. So this:
Application.Run(new Form1());
was okay, but this:
Form1 form = new Form1();
|
by: Shashank Bhardwaj |
last post by:
Hello Friends!
Can you help me for calling a exe or bat file by the code of vb6.0?
Thanks.
|
by: mxdevit |
last post by:
Task: run application from ASP.NET
for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)
System.Diagnostics.Process.Start("notepad");
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |