Posted by Colin McKinnon on 06/19/05 00:00
john@munsey.net spilled the following:
> Newbie about this stuff.
>
> I want to run some php scripts from a shell script(bash?)
>
> the php script i want to run is this:
> test.php
>
> and it's path is this:
> home/virtual/blahblah.com/home/abc/mainwebsite_html/bluhbluh/dbtest/
>
> 1. How would I creat the shell script?
> 2. How would I execute it?
>
> I have already tried ot figure it out with no success.
>
> I have php 4.2.2
PHP can be compiled as a standalone binary or as a module for various
webservers. The former can also be used in conjunction with a webserver.
Life's a lot simpler if you have the standalone binary. I use SuSE mostly -
it's mod_php rpm includes both the module and standalone interpreter. If
you have got it on your machine it'll probably be called 'php' and is
likely to be in /usr/bin or /usr/local/bin. First thing to try would be
`which php` - then try looking in the directories for something named *php*
Then it's just a matter of running the interpreter with the script as the
first argument. e.g.
php /home/virtual/blahblah.com/home/abc/mainwebsite_html/bluhbluh/dbtest/test.php
although you may not want extraneous html in your output so....
php -q test.php
Just in case you can't find it, and can't install your own, you can fetch a
web page from the comand line using a variety of tools - most boxes will
have wget and/or curl.
HTH
C.
Navigation:
[Reply to this message]
|