RE: [PHP] Using PHP as a shell script
| From: | John Huggins | Date: | Fri, 09 Mar 2001 19:26:26 +0000 |
| Subject: | RE: [PHP] Using PHP as a shell script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43193@lists.php.net to get a copy of this message | ||
>
> 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