Page 1 of 1

phpinfo() says I have PHP 5, php -v says PHP 4

Posted: Wed Jun 11, 2008 9:53 pm
by JasonTC
I'm running Mac OS 10.4.11 and Apache 1.3.41, although I've read about similar problems on different OSs.

When I run phpinfo(), it tells me I have PHP 5.2.4. When I do "php -v" from the command line, it tells me I have PHP 4.4.8. I want PHP 5 only.

When I run phpinfo() from the command line, the output (which still says 4.4.8 there) tells me:

Code: Select all

Configuration File (php.ini) Path => /etc
The only php.ini-like file that seemed to be in /etc was /etc/php.ini.default. I renamed it to /etc/php-THISSHOULDNOTWORK. PHP 4 still worked, even after restarting the whole computer.

Any ideas? The only posts I've found are people with the opposite problem - phpinfo() says PHP 4, command line says PHP 5. The solutions to that problem didn't apply here.

Also, there's this:

Code: Select all

jason-swetts-computer:~ root# find /* -name *php.ini*
/Users/jasonswett/php-5.2.4/php.ini-dist
/Users/jasonswett/php-5.2.4/php.ini-recommended
/Users/jasonswett/php-5.2.4/php.iniJASON
/usr/local/lib/php.iniJASON
/usr/local/php5/lib/php.ini-recommended
/usr/local/php5/lib/php.iniJASON
jason-swetts-computer:~ root#
If there's no php.ini on the whole system, I don't see how any PHP could be running, let alone two versions at the same time. Does the file not have to be called php.ini?

Thanks,
Jason

Re: phpinfo() says I have PHP 5, php -v says PHP 4

Posted: Wed Jun 11, 2008 10:53 pm
by Christopher
Sounds like you still have the command line PHP4 executable installed somewhere. Do a "where php" and find that executable. Run it with and absolute path to see what version is it. Remove/move it and do "where php" again to see if PHP5 is installed elsewhere.

Re: phpinfo() says I have PHP 5, php -v says PHP 4

Posted: Wed Jun 11, 2008 10:58 pm
by JasonTC
Thanks for the reply.

Doing a "whereis php" showed me /usr/bin/php. I moved it and the php command was no longer recognized (and "whereis php" no longer returned results).

I did find my PHP 5 executable in /usr/local/php5/bin/php. Running "/usr/local/php5/bin/php -v" gave me PHP 5.2.4 like I would want.

How do I tell my system to use the executable in /usr/local/php5/bin instead of /usr/bin/php?

Re: phpinfo() says I have PHP 5, php -v says PHP 4

Posted: Wed Jun 11, 2008 11:27 pm
by Christopher
Or create a symbolic link as /usr/local/bin/php to the actual executable.

Re: phpinfo() says I have PHP 5, php -v says PHP 4

Posted: Thu Jun 12, 2008 5:36 pm
by JasonTC
I just copied the file and that worked. Perhaps a symbolic link would be better.

Thanks!