You have to have the game server to run this program!!!!
Here is my script:
--------------------------------BEGIN_SCRIPT---------------------------
set_time_limit(0);
print "The Server is opening...\n";
$command = "C:\Sierra\Half-Life\hlds.exe -game cstrike -heapsize 128000
+exec server.cfg +port 27015 +maxplayers 12 +map de_dust";
chdir ('c:\\SIERRA\\Half-Life') or die (print "Unable to change
directory!\n");
$result = popen($command." & 1> output.txt 2>&1; print output.txt; &", 'w');
fputs ($result, "map de_dust");
if ($result){
print "The Server is open!\n";
} else {
print "The Server is not open!\n";
}
----------------------------END SCRIPT--------------------------------
This is the part that people think windows does mot support but its the only
way to get the program to run in the bg. Windows does support the & and the
2>&1. If you have another way to do this or it works without it then please
tell, my ears are open, at least my eyes are :-)
$result = popen($command." & 1> output.txt 2>&1; print output.txt; &", 'w');
Thats it!
Thanks again,
Josh Seward
[EMAIL PROTECTED]
----- Original Message -----
From: "Steph" <[EMAIL PROTECTED]>
To: "Josh Seward" <[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 8:37 PM
Subject: Re: [PHP-GTK] fopen, popen, fputs????
Josh, I've a feeling that when you open your program then php dies.
Can I see, please?
----- Original Message -----
From: "Josh Seward" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "php-gtk" <[EMAIL PROTECTED]>; "Steph"
<[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 11:57 PM
Subject: Re: [PHP-GTK] fopen, popen, fputs????
I have managed to open the program I want to in the background.
My php script opens the outside windows app. Then my prog. will continue to
run.
The only thing I need to do is send command (say: dir /p in the cmd.exe
under windows 2000)
so that it runs in the program I initially open in the background.
My prog. I am writing actually opens a game server and I want to send
commands to it at different times when needed. As of now the game server
does open in the background but I can not issue it commands!
Sorry if all my e-mails are getting annoying. I just have been stuck in this
spot for a while:-)
Thanks for all the help I have recieved so far though. It has helped
GREATLY!
----- Original Message -----
From: "Steph" <[EMAIL PROTECTED]>
To: "Josh Seward" <[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 6:31 PM
Subject: Re: [PHP-GTK] fopen, popen, fputs????
ps What *kind* of commands? What kind of app? - I've tested writing to
Windows apps, most of them seem to work ok.
- tell ppl what you're doing, there may be a workaround. I just went thru
this forking biz with a fine-toothed comb, looks like it's only going to
work when the initial process is recognised as a parent, ie within PHP-GTK.
----- Original Message -----
From: "Steph" <[EMAIL PROTECTED]>
To: "Josh Seward" <[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 10:55 PM
Subject: Re: [PHP-GTK] fopen, popen, fputs????
Josh, we've a Windows issue extant .... All the clever ppl in Boston etc
aware ...
Have you managed to open a Windows exe while running a php script in the
background, is the big question?!
Fwding something someone sent me on forking but am not at all certain I
understand it; maybe you will.
Cheers anon,
Steph
----- Original Message -----
From: "Josh Seward" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "php-gtk" <[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 10:38 PM
Subject: [PHP-GTK] fopen, popen, fputs????
Is anyone able to open the command.exe from a php script then issuse it
commands via the php script. I have tried using popen and fopen to open
cmd.exe and that works, but I cannot seem to issue comamnds to an outside
program!!!!
HELP PLEASE!!!
Thank you,
Josh Seward
[EMAIL PROTECTED]
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]