Click to See Complete Forum and Search --> : phpinfo in apache shows new version shell php -v shows old version


danielftl
12-11-2002, 02:21 PM
Hi Everyone,

I've seen in here where users type php -v at the shell and get the new version while running phpinfo() in a php page on apache and get the old version, but in my case, I have just the opposite. In apache phpinfo, I get php version php 4.2.3, while the shell php -v command yields php 4.1.2. Any ideas how to correct that? It is the shell that I am most interested in.

System Details: i586 Redhat Linux 7.1. Apache and PHP were installed from the RedHat CD. For the upgrade, the apache source was download and installed and then the PHP source was downloaded and installed according to the instructions at http://www.php.net/manual/en/install.apache.php (obviously the ./configure command was different, but it follows:

./configure i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --prefix=/usr --with-config-file-path=/etc --enable-force-cgi-redirect --disable-debug --with-exec-dir=/usr/bin --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-track-vars --enable-trans-sid --without-oci8 --with-mysql=/usr/local/mysql --with-xml --enable-memory-limit --enable-versioning --enable-calendar --with-apxs=/www/bin/apxs

I appreciate any advice you can offer in getting the shell to use and show the latest version

Thanks.

Daniel

dalecosp
12-11-2002, 04:48 PM
Originally posted by danielftl
Hi Everyone,

I've seen in here where users type php -v at the shell and get the new version while running phpinfo() in a php page on apache and get the old version, but in my case, I have just the opposite. In apache phpinfo, I get php version php 4.2.3, while the shell php -v command yields php 4.1.2. Any ideas how to correct that? It is the shell that I am most interested in.


You now have two binaries of php on your system. Do:

$whereis php

to try and locate the 'old' one, or at least figure out which the system thinks is the proper one. AAMOF, it could be that phpinfo(); will tell you the path to the 'new' one.

From the info you posted from ./configure, it looks like the new one is either in /usr, /usr/bin, or /usr/sbin, but I'm not a Penguin guy, so I'm not sure.

Find the new one and link or cp or overwrite the old one. You're probably using bash<?>, so I doubt that 'rehash' is an issue like it is in tcsh....

danielftl
12-11-2002, 06:12 PM
Thank you, but I knew about that command already and that didn't help. However, I did solve the problem with brute force. I will explain how I did it now. Firstly, the ./configure command in my original post was missing --enable-cli (required for 4.2.3 if you want to run php on the shell). Anyway, logged in as root and in root's home directory I did the following:

$ find / -name php
I then deleted every directory and file that was returned
Then I went to the directory where the source was and did a $ /bin/rm -r php_directory

Then I untarred the distribution again. CD'ed into the source directory and ran my ./configure command again, this time with the --enable-cli in place. It ran through ./configure fine, it ran through make fine, and it ran through make install fine.
I copied the php.ini file from the source directory to /etc/php.ini.

I went to root's home (cd /) and did another find / -name php. I saw the includes and the libraries and noticed that the php executable (the actual php program was in a sub-directory of the source.

I copied that php executable file to /usr/bin/php and then navigated to that directory to ensure that its permissions were similar to other executes in that directory.

Logging out of root and then in as myself, I then did a php -v and bim bam boom I got what I wanted:
[dreimann@localhost dreimann]$ php -v
4.2.3
[dreimann@localhost dreimann]$

Refer to http://www.php.net/manual/en/features.commandline.php on where to copy the php executable/binary.

Apache is happy as a clam too, so all is well.

That's what makes unix so cool....

dalecosp
12-11-2002, 06:21 PM
Thanks for the link, it's instructional. The fact is that you'd be able to call php from the shell no matter where is was in your path*...you just needed to get the old one out and the new one in someplace logical. Glad to hear it's all up now....

*as long as it WAS in the path, I mean