Re: Using PHP as a shell script
| From: | Chris Lee | Date: | Fri, 09 Mar 2001 19:18:21 +0000 |
| Subject: | Re: Using PHP as a shell script | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43213@lists.php.net to get a copy of this message | ||
I use a script like this, place it in cron, run it once a day to search the db and email the
nescisary people the reminders they request.
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
lee@mediawaveonline.com
""John Huggins"" <huggins@tls2000.com> wrote in message news:002201c0a8ce$d57e08b0$74ee9ace@tlsusa.com...
>
> Hi all.
>
> Can I use PHP as a shell script, like bash? Or this is inviable,
> impossible
> and/or out of question?
>
It is viable and works great. You must have a php binary somewhere from a
default installation of PHP. Usually, this binary is found somewhere like
/usr/local/bin/php.
Then make a file.
#!/usr/local/bin/php -q
<?
print("Hello World\n");
?>
Then chmod it so it is executable like so.
chmod 755 thefilename
It works for me. This is a very convenient way to obtain access to
databases from shell scripts.
Good luck.
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net