Web Hosting Talk







View Full Version : Executing PHP scripts through the command line


archangel777
05-08-2002, 02:33 AM
I'm trying to execute some of my PHP scripts through the unix command line, rather than through the web. However, it only seems to work on RPM versions of PHP, and not the tarred versions.

I know all you had to do in the RPM versions, was to simply do a "php my_script.php" to execute it, but I can't figure it out on the tar versions of it.

I'm using Red Hat 7.1 and 7.2. Any help would be very much appreciated...

Starhost
05-08-2002, 05:44 AM
wget "url_to_.tar.gz"
tar -zxvf "file.tar.gz"
cd /php_dir/
rm -f config.cache
make clean
./configure --prefix=/usr --with-mysql (you can also add some other options)
make

[b](don't do a make install, because you then will overwrite your currunt mod_php)

cp php /usr/bin

Now you have a php excecutable. You can now start scripting PHP shell scripts. Make sure you start them with:

#!/usr/bin/php -q
<?
echo "My PHP shell scripts works!";
?>

archangel777
05-08-2002, 09:16 PM
thanks! I'll give it a try.