Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 04-16-2008, 09:44 AM Exec/system problem
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Hello

I would like to launch exe/bat file via php. I have windows Vista, php5, apach2



When I use

Code:
exec('dir > output_aaa.txt');

everything is ok , but when I try

Code:
system('notepad.exe')

it doesn't work at all. Scripts starts executing but it never stops and notepad(in this case) doesn't open.

Does anyone have idea what to do? Maybe some config in httpd.conf?

I'm looking forward to your help
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
 
Register now for full access!
Old 04-16-2008, 10:44 AM Re: Exec/system problem
Ultra Talker

Posts: 483
Trades: 0
I don't use Apache on Windows myself, but I think I've read about this before: essentially, Apache is running as the SYSTEM user which does not have the rights to load anything on the screen.

From what I can remember, you need to tell Windows to run the service as the user whose GUI is being run (and whose GUI the program will eventually load on).
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 04-16-2008, 11:12 AM Re: Exec/system problem
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 933
Trades: 7
TwistMyArms answer is correct!

You could get round this by writing a windows app in C, or batch or whatever you like.. have it go look for a lock file every so often, if it exists, open your notepad.exe... the php script would then just have to create the lock file
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 04-16-2008, 02:48 PM Re: Exec/system problem
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Thanks for your help but I think I'll have to give up.

I use the following script:

Code:
<?php
   error_reporting(E_ALL);
   chdir('blabla');

   $command = 'psexec  -u marcin -p mypassword d:\www_wamp\blabla\odt.bat d:\www_wamp\blabla\archive.odt >NUL 2>&1';   
   exec($command);
?>
When I use string assign to $command variable not in PHP but in CMD it works fine, but when I launch PHP script the situation is the same as earlier - the script never stops.

Similar situation is when I use:

Code:
$command='psexec  -u marcin -p mypassword  dir >hhh.txt';
as command in PHP.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Reply     « Reply to Exec/system problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13598 seconds with 12 queries