Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

different version php on command line and in apache

Tags:

php

macos

apache2

I am using mac 10.8 and I have installed php 5.5. At command line php -v show version 5.5. but when I starts mac's apache server with phpinfo(), it show version 5.4.

Can anyone please help me how to make apache to use version 5.5

Thanks

like image 235
amique Avatar asked Oct 24 '13 00:10

amique


People also ask

Can I have 2 versions of PHP installed?

Add a PHP Repository So you'll need to add the PHP repository in your system to install the multiple PHP versions. Once the repository is up-to-date, you can proceed to install multiple PHP versions.


2 Answers

  1. find out the conf/httpd.conf and conf.d/*.conf

  2. find the tag like this: LoadModule php5_module modules/libphp5.so

  3. make the change to correct php installation folder like this: LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so

This will change your php model (php version) in Apache

Search on your local desk: find / -name "libphp5.so"

Regarding the correct so file: libphp5.so not being created after compiling and prefix directory not created

[update]

http://www.howtoforge.com/centos-5.6-php53-common-conflicts-with-php-common

1) update yum to include latest php

2) For 64bit systems, you can find the correct packages here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/

For 32bit systems, the correct packages are here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/

3) (replace to the correct URL and file name which you want to have, check it from step "2)")

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-11.ius.el5.noarch.rpm

4) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

5) yum install yum-plugin-replace

6) You can now replace your PHP old version packages with the PHP new version packages from IUS like this:

yum replace php --replace-with php55w

You can search for further php55w packages like this:

yum search php53u

like image 166
Peter Avatar answered Oct 17 '22 08:10

Peter


If you uncommented the line LoadModule php5_module /usr/local/php5/libphp5.so in httpd.conf comment it again, then add the line export PATH=~/bin:/usr/local/php5/bin:$PATH in .bash_profile This did the trick for me. Note: i have installed php5.5.5 via liip on OS X Mavericks

like image 29
Mr. Crowley Avatar answered Oct 17 '22 07:10

Mr. Crowley