views:

206

answers:

1

Hi, I have just bought a VPS running Ubuntu and I need to install the LAMP stack with PHP 5.1.6. The VPS came with no PHP installed (checked this from the shell with php -v) and with Apache/2.2.12 installed. I installed PHP 5.1.6 from source and compiled it with Apache 2.2 (using libapache2-mod-php5), tried a phpinfo() test which worked fine, however, phpinfo() shows the PHP version as 5.2.1 (with JSON enabled), whereas running php-v in the shell shows as 5.1.6. Anyone any ideas what might be happening here? I need to ensure I am running PHP 5.1.6.

Thanks in advance for any help!

+2  A: 

php -v gives you the version of the cli installation of php, while phpinfo will give you the version which got installed as apache module.

If you are not using cli php anywhere, you should be fine with running php scripts off apache. But ideally you should fix this.

s1d
Thanks s1d. The problem is i need to use version 5.1.6 with apache (for web devt), so i need to reconfigure it. I ran ./configure again this time using "--with-apx2=/path/to/apxs" (which i missed out last time) - but after restarting apache i still have PHP 5.2.1 showing. Do i have to remove the libapache2-mod-php5 module (not sure how to do this other than reinstalling apache) and rerun ./configure?
kenny99
I think the issue is this that your apache and libapache2-php5-mod have been installed via ubuntu packages while you have compiled php from source.When you installed libapache2-php5-mod via apt-get install, it would have taken the relevant php package from the repo as a dependency, as seen in http://packages.ubuntu.com/hardy/libapache2-mod-php5You will need to uninstall apache, and then install apache from source instead of using the ubuntu repos to do what you wish to do.
s1d
Ah that makes sense, I did use apt-get to install libapache2-php5-mod. Ok, so i need to uninstall apache and reinstall from source, along with all the necessary modules, time to check the docs for how to do that properly!
kenny99