Re: scripting with php
| From: | Richard Lynch | Date: | Wed, 15 Dec 2004 18:05:56 +0000 |
| Subject: | Re: scripting with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204423@lists.php.net to get a copy of this message | ||
Bruno Santos wrote:
> i'm working with php for about 3 years and i must say: i cant get tired
> of it !! :-)
>
> since my first page, ive used php as a server side language, embebed in
> html pages. now, i need to develop a small script to run as stand alone.
> how can i do it ?
>
> just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not
> working ...
>
> can someone tell me how to i use php stand alone ?
> chears !!!
'shell> ' indicates something you type at a Un*x/MS-DOS shell prompt.
Step 1.
Confirm that /usr/bin/php is there, and working:
shell> /usr/bin/php -v
Either this outputs PHP's version number, or you don't have PHP installed
at /usr/bin/php.
Step 2.
Make sure your script works, *without* the #!/usr/bin/php -q line in it.
shell> php -q YOURSCRIPT.php
Either this script does what you expect, or the script isn't right.
Did you put <?php ?> in there? Yes, you need to put <?php ?> in there.
Step 3.
Make sure your PHP shell script is executable:
shell> chmod 744 YOURSCRIPT.php
Change YOURSCRIPT to the name of your script, of course.
Step 4.
Put the #!/usr/bin/php -q back in there and try it
shell> ./YOURSCRIPT.php
--
Like Music?
http://l-i-e.com/artists.htm