It appears that the php command line is using a different php.ini from the main php interpreter. I am using Ubuntu 10.4. My problem is that in the main php.ini I have included an extra path for an external library, but in the cli version this is not present, and so I have a path inclusion error.
thanks
Interesting in windows is that in both tests (on apache with phpinfo() and in cli with php --ini), the configuration file path is c:\windows. More info here
Better yet:
$ php --ini
This will also show all extra *.ini files loaded (usually hanging around in some conf.d dir in debian):
Note that this was about php-cli, php-cgi does not have this afaik.
You can find php.ini using the below command. in LINUX
or
Just ask PHP:
$ php -i |grep php\.ini
I had the same problem. Simply check owner and permissions from every files in /etc/php5/conf.d/. It has to be owned by root and readeable by anymone.
At my last job, I got in the habit of specifying my ini file on every execution...