Php runs differnt from a command line, b

I just found this,
which I think is relevant to the problem I was having in the thread below, where I can’t seem to get a script to find mysqli_connect when running the script from a command line. Apparently there is another SAPI type for PHP that is designed for running php from the command line. The CLI SAPI is available depending on the options used during the make of php. On dreamhost when I run php -v I only see cgi SAPI.

This signature line intentionally blank.

Hey, I just noticed something else. phpinfo.php tells me that PHP 5.2.1 is what’s available to the webserver, while php -v tells me that PHP 4.4.4 (cgi) is what’s available at the command line. mysqli methods are only available with php 5, so that’s probably why my routines stopped when they hit any of the mysqli calls.

This signature line intentionally blank.

$ whereis php
php: /etc/php /usr/local/bin/php /usr/local/lib/php
$ whereis php5
php5: /etc/php5 /usr/local/php5
$ whereis php4

$ echo $PATH

Games?! :smiley:

[color=#00CC00]ANONYMOUS0 => Max Discount[/color], [color=#6600CC]ANONYMOUS2 => Max Discount less $1[/color] or Cut the code, [color=#CC0000]it’s their birthday:[/color] [color=#00CC00]9999 => $99.99 Off[/color]

Interesting, but I don’t seem to be able to run the script with the command line like: /etc/php5 ~/path/scriptname.php

Put /etc/php5 at the top of the script?

This signature line intentionally blank.

Why are you trying to run php5 from the /etc (config file) directory? That’s not even a binary!

The actual location of the PHP5 binary should be here:

You can also do /dh/cgi-system/php5.cgi
I don’t know why that works, but I remember that someone found it for me when I was having trouble running the maintenance scripts for my MediaWiki installation (which uses PHP5).
Very little to do with either emus or farmers!