Good Heavens
Ubuntu同时安装php5.3及5.2
项目中要用到zend Optimizer,但是目前只支持php5.2,Ubuntu默认安装的php版本为5.3,找了好多
方法,终于借助下面这篇文章的方法成功的安装了5.2及5.3两个版本的php
文章地址:http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204
Although Drupals 7+ run smoothly on PHP 5.3, Drupal 6 still feels much better with PHP
5.2. Even though D6 core is compatible with PHP 5.3 for quite some time now, a lot of
contributes modules still get nasty hiccup when asked to run on the newer version.
Therefore developing for both D7 and D6 at the same time becomes much less painful
when running both versions of PHP in parallel.
One way of doing it is using mod_php5 Apache module to serve PHP 5.3 applications,
while running PHP 5.2 applications using fastcgi module. Under Ubuntu 12.04 this can be
achieved by installing PHP 5.3 from the repositories and manually compiling and installing
PHP 5.2 afterwards.
Installing PHP 5.3 from repositories is fairly easy process, which you most probably
already have under your belt, so let's just say that it looks more or less like this:
sudo apt-get install php5 php5-common php5-cli php5-dev php5-mysql
phpmyadmin php5-pgsql phppgadmin php5-gd php5-mcrypt php5-curl php-pear
libapache2-mod-php5 php5-xdebug php5-codesniffer
What is much more interesting though, and what this post will focus on, is how to add
PHP 5.2 to the whole picture and make both those versions work nicely together.
Please note that this tutorial is for Apache's name-based virtual hosts, and essentially
leaves PHP 5.3 enabled globally while allowing to use PHP 5.2 on specific, selected
virtual hosts only.
Download PHP sources
Let's then start with downloading PHP 5.2 sources from Unsupported Historical Releases
list.
I have originally started with version 5.2.10 (as it is the same version that we have on
our production servers), but then was stopped short by OpenSSL error during
configuration stage:
/usr/include/openssl/conf.h:132:7: note: expected 'struct
lhash_st_CONF_VALUE *' but argument is of type 'int *'
make: *** [ext/openssl/openssl.lo] Error 1
to which I was not able to find any good fix (relatively easy to apply anyway), so finally
ended up with the most recent version from 5.2 branch - 5.2.17, where those errors
haven't occured anymore.
Let's then download and uncompress PHP sources into ~/Downloads/php-5.2.17
directory:
mkdir -p ~/Downloads/php-5.2.17
cd ~/Downloads/php-5.2.17
wget http://museum.php.net/php5/php-5.2.17.tar.gz
tar zxf php-5.2.17.tar.gz
Configure
Time to configure the package. Example ./configure call could look as follows:
sudo ./configure \
--prefix=/usr/share/php52 \
--datadir=/usr/share/php52 \
--mandir=/usr/share/man \
--bindir=/usr/bin/php52 \
--with-libdir=lib64 \
--includedir=/usr/include \
--sysconfdir=/etc/php52/apache2 \
--with-config-file-path=/etc/php52/cli \
--with-config-file-scan-dir=/etc/php52/conf.d \
导航
博客园 首页 联系 订阅 管理
公告
统计
随笔 - 46 文章 - 1 评论 - 2
Powered by:
博客园
Copyright ©zhanghw0354