PDA

View Full Version : PHP running without a webserver


^BuGs^
09-21-2002, 04:51 PM
from http://news.php.net/article.php?group=php.kb&article=21


How do I run PHP from the command line or as a shell script?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/12
------------------------------------------------------------

Install PHP in CGI mode. You can of course have both (CGI and module)
on the same system.

When you get there, php -h gives you the command line parameters you may
find useful. And you can use the !# construction to cause the script to
load php.

The syntax is:

#!/path/to/php
<?php
// your php code
?>

and if you want to stop it from sending the CGI-style headers, do:

#!/path/to/php -q
<?php
// your php code
?>

On a win32 system, just cd to the dir that the script is in and type the
script name:

C:\>myscript.php

Note, however, that if the script is a form that posts back to itself,
the only thing you will get is the form elements echoed to the console.
You will have to hardcode the form field values first if you want to see
the post in action.

Also, the .php extension should be registered to be executed with
php.exe


Any questions? :)

Uranium-235
09-21-2002, 10:25 PM
in a windows system. how do I get this to display in IE without outputting the file through dos '>'

Halide
09-22-2002, 12:53 PM
this doesn't answer your question oh well

php.exe -f yourfile.php > temp.html
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" temp.html

^BuGs^
09-22-2002, 01:02 PM
Originally posted by Halide
this doesn't answer your question oh well

php.exe -f yourfile.php > temp.html
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" temp.html


But this works...