php-windows Digest 29 Apr 2002 01:38:58 -0000 Issue 1117

Topics (messages 13367 through 13374):

PHP Command Line Syntax
        13367 by: Scott Dowd
        13368 by: Advanced
        13369 by: Stuart Dallas
        13370 by: Steve Cook
        13371 by: David Elliott

Re: executing an external program
        13372 by: Ross Fleming
        13373 by: Ross Fleming
        13374 by: RoboTeddy

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I would like to schedule a series of PHP pages to run overnight from a
Win2k/IIS/PHP4 box. An example of the url is
http://localhost/checklist/checksingle.php?servername=SERVERNAME. When I try
to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
works fine, but when I add "?servername=SERVERNAME" as in the url, it does
not recognize the command.

"PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
Unknow
n on line 0"

Is this the best way to schedule a PHP page to run ?

Thanks,
Scott.


--- End Message ---
--- Begin Message ---
CRON

"Scott Dowd" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I would like to schedule a series of PHP pages to run overnight from a
> Win2k/IIS/PHP4 box. An example of the url is
> http://localhost/checklist/checksingle.php?servername=SERVERNAME. When I
try
> to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
> works fine, but when I add "?servername=SERVERNAME" as in the url, it does
> not recognize the command.
>
> "PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
> Unknow
> n on line 0"
>
> Is this the best way to schedule a PHP page to run ?
>
> Thanks,
> Scott.
>
>


--- End Message ---
--- Begin Message ---
Set the environment variable QUERY_STRING prior to running PHP...

set QUERY_STRING=servername=SERVERNAME
c:\php\php.exe -q checksingle.php

HTH,
Stuart

-----Original Message-----
From: Scott Dowd [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2002 12:32
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] PHP Command Line Syntax


I would like to schedule a series of PHP pages to run overnight from a
Win2k/IIS/PHP4 box. An example of the url is
http://localhost/checklist/checksingle.php?servername=SERVERNAME. When I try
to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
works fine, but when I add "?servername=SERVERNAME" as in the url, it does
not recognize the command.

"PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
Unknow
n on line 0"

Is this the best way to schedule a PHP page to run ?

Thanks,
Scott.



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
If you're running from the command line, you can use
standard command line arguments.  In the file they'll
be entered into the array $argv[].  $argv[0] is the name
of the script called, and each other argument is
consecutively numbered.

For example the file test.php:

<?  #test.php
print("Arg0 is $argv[0]\nArgv1 is $argv[1]\n");
?>

running: c:\php\php.exe -q test.php SERVERNAME
would print:

Argv0 is test.php
Argv1 is SERVERNAME

If you want to use the same php file on the server as for
command line, just put a check at the start to see if argv
is defined and has elements, and if so, map them to your
QUERY equivalants.
(e.g. if(count(argv)>1) {$servername=$argv[1]}   )

-steve
http://www.cheatcodes.com/
http://www.gear21.com



> -----Original Message-----
> From: Scott Dowd [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, April 28, 2002 5:32 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP Command Line Syntax
>
>
> I would like to schedule a series of PHP pages to run overnight from a
> Win2k/IIS/PHP4 box. An example of the url is
> http://localhost/checklist/checksingle.php?servername=SERVERNAME.
> When I try
> to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
> works fine, but when I add "?servername=SERVERNAME" as in the url, it does
> not recognize the command.
>
> "PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
> Unknow
> n on line 0"
>
> Is this the best way to schedule a PHP page to run ?
>
> Thanks,
> Scott.
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings Wayne

On 28 April 2002 at 16:51:24 -0400 (which was 21:51 where I live) Wayne
Fraser might have written

WF> I will reiterate
WF> CRON CRON CRON
WF> I use a version of cron compiled to run on windows.

I plead ignorance. I have never seen this, but I would like to.

WF> I have it running on 57 win2k servers

WF> I have it running 35 different php file on one machine.
WF> These range from every 3 minutes to every month.

WF> You are welcome for "these words of wisdom"

I apologize.

Please could you enlighten us all where you can get this util.


WF> ----- Original Message -----
WF> From: "David Elliott" <[EMAIL PROTECTED]>
WF> To: "Advanced" <[EMAIL PROTECTED]>
WF> Sent: Sunday, April 28, 2002 4:27 PM
WF> Subject: Re: [PHP-WIN] Re: PHP Command Line Syntax


>> Hello Advanced
>>
>> On 28 April 2002 at 15:58:49 -0400 (which was 20:58 where I live) Advanced
>> emanated these words of wisdom
>>
>> >> I would like to schedule a series of PHP pages to run overnight from a
>> >> Win2k/IIS/PHP4 box. An example of the url is
>>
>> A> CRON
>>
>> LOL
>>
>> CRON on windows!!
>>


- - --
 Regards,                  _______________________________________________
  David                   |    David  Elliott    |   Software Engineer    |
 _________________________|  [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
| My God man. We've become a tourist attraction. --Londo.                 |

- -----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt Build 07
Comment: PGP Signed, sealed, delivered.

iQA/AwUBPMxkNvmK8eZlD0U0EQJa4gCfQ1F8S8ujBGWDG5s73eaW/PUi20AAn3Oh
HAIFPyTuTpXcrkvs8mvToOKJ
=9BLT
- -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt Build 07 
Comment: PGP Signed, sealed, delivered.

iQA/AwUBPMxkQfmK8eZlD0U0EQJKOgCfcLYBN/fHBT2F5MLqgTW/LoRHKoAAoPhM
r+153jfT0GQMpGVVn3o3Mz9p
=9nVc
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
Yes that will indeed run winword.... on the client machine.  Using exec()
will run winword on the host machine, which is what I believe Rainer wishes
to do.

However, it's documented somewhere that the exec() family of functions can't
work very well with programs with a GUI, only command line programs (ie it's
intended for linux and windows is only partially catered for).  The command
you want to execute it is
<?
Exec('"C:\PROGRAMME\MICROSOFT OFFICE\OFFICE\WINWORD.EXE"');

echo ("running");
?>

However, while this will indeed run office, the PHP parser will wait until
it closes again before continuing, so internet explorer at the client end
will hang and not continue to load until the server closes winword.  (ie,
echo "running" will never be reached).  I believe it is possible for exec to
continue on, but it involves routing the output of exec to a null pointer,
something I don't believe I ever managed to do (any suggestions anyone?)

On a happier note, what you are probably trying to achieve may be possible.
If you only want to extract data from a winword file, then take a look at
COM which I believe should do that.

Ross



-----Original Message-----
From: Webmaster [mailto:[EMAIL PROTECTED]]
Sent: 27 April 2002 22:18
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: executing an external program


If you have your mime type settings set correct in your Internet Explorer,
you just have to do a HTML call to a Winword document to make Winword
integrate with the browser !

The way you are trying now is the most dangerous one, because it can then
too execute other programs remotely !

This is also why most servers have the _exec command turned off....

C vd Veen


"Rainer Bruch" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i am new in using and understanding php. need help in following issue:
> opening (executing) an external program (not a file) like "winword.exe"
with
> php4.
> my system-configuration:
> - windows 2000
> - php4 1.1.1
> - winword execution program-path is:
> "c:\programme\micosoft office\office\winword.exe"
>
> please, will somebody out there will help me with the complete php-code
> like:
> <?
> "code to execute the winword-program";
> ?>
>
> i have asked a so called specialist who gave the following (not
functioning,
> no error message) code:
> <?
> shell_exec("c:\programme\microsoft office\office\winword.exe");
> ?>
>
> thanks to all who will help me
> rainer
>
>



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
OK, I've just found a way to do it (in the comments for exec() on the php
webpage), however I DON'T know if it will work on Win2000, I'll let you try,
it works on win98 anyway:

<?
exec("COMMAND.COM /C START c:\progra~1\micros~1\office\winword.exe >NUL");
?>

This opens winword and keeps it running and completes the web page too.

If this doesn't work in win2K, maybe someone on this list may know an
alternative?..

Ross

-----Original Message-----
From: Rainer Bruch [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2002 23:30
To: [EMAIL PROTECTED]
Subject: AW: [PHP-WIN] Re: executing an external program


hey ross,
thanks for your help by sending this e-mail.
maybe you have a solution for my problem described below?
since you have kindly e-mailed to me i feel free to inform you as following
about the the e-mail
conversation concerning this matter between mike flynn and myself.
if you read this you can find that you are right, the server hangs up!


"Rainer Bruch" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i am new in using and understanding php. need help in following issue:
> opening (executing) an external program (not a file) like "winword.exe"
with
> php4.
> my system-configuration:
> - windows 2000
> - php4 1.1.1
> - winword execution program-path is:
> "c:\programme\micosoft office\office\winword.exe"
>
> please, will somebody out there will help me with the complete php-code
> like:
> <?
> "code to execute the winword-program";
> ?>
>
> i have asked a so called specialist who gave the following (not
functioning,
> no error message) code:
> <?
> shell_exec("c:\programme\microsoft office\office\winword.exe");
> ?>
>
> thanks to all who will help me
> rainer
>
>



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
For win 2k/xp:
<?
exec("CMD /C START c:\progra~1\micros~1\office\winword.exe >NUL");
?>
Ted
----- Original Message -----
From: "Ross Fleming" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "PHP Windows mailing list"
<[EMAIL PROTECTED]>
Sent: Sunday, April 28, 2002 7:32 PM
Subject: RE: [PHP-WIN] Re: executing an external program


> OK, I've just found a way to do it (in the comments for exec() on the php
> webpage), however I DON'T know if it will work on Win2000, I'll let you
try,
> it works on win98 anyway:
>
> <?
> exec("COMMAND.COM /C START c:\progra~1\micros~1\office\winword.exe >NUL");
> ?>
>
> This opens winword and keeps it running and completes the web page too.
>
> If this doesn't work in win2K, maybe someone on this list may know an
> alternative?..
>
> Ross
>
> -----Original Message-----
> From: Rainer Bruch [mailto:[EMAIL PROTECTED]]
> Sent: 28 April 2002 23:30
> To: [EMAIL PROTECTED]
> Subject: AW: [PHP-WIN] Re: executing an external program
>
>
> hey ross,
> thanks for your help by sending this e-mail.
> maybe you have a solution for my problem described below?
> since you have kindly e-mailed to me i feel free to inform you as
following
> about the the e-mail
> conversation concerning this matter between mike flynn and myself.
> if you read this you can find that you are right, the server hangs up!
>
>
> "Rainer Bruch" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > i am new in using and understanding php. need help in following issue:
> > opening (executing) an external program (not a file) like "winword.exe"
> with
> > php4.
> > my system-configuration:
> > - windows 2000
> > - php4 1.1.1
> > - winword execution program-path is:
> > "c:\programme\micosoft office\office\winword.exe"
> >
> > please, will somebody out there will help me with the complete php-code
> > like:
> > <?
> > "code to execute the winword-program";
> > ?>
> >
> > i have asked a so called specialist who gave the following (not
> functioning,
> > no error message) code:
> > <?
> > shell_exec("c:\programme\microsoft office\office\winword.exe");
> > ?>
> >
> > thanks to all who will help me
> > rainer
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---

Reply via email to