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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

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

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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.
(#10850)
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

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

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post by Christopher »

Or create a symbolic link as /usr/local/bin/php to the actual executable.
(#10850)
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

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

Post by JasonTC »

I just copied the file and that worked. Perhaps a symbolic link would be better.

Thanks!
Post Reply