ubuntu安装php5.5,ubuntu下安装php5.3的实例参考

介绍ubuntu中安装php5.3的方法。

首先,安装常用的编译器及库文件:

复制代码 代码示例:

sudo apt-get install gcc

sudo apt-get install g++

sudo apt-get install autoconf

sudo apt-get install libxml2

sudo apt-get install libxml2-dev

sudo apt-get install libevent-1.4-2

sudo apt-get install libevent-dev

sudo apt-get install bzip2

sudo apt-get install libbz2-dev

sudo apt-get install libcurl3-gnutls

sudo apt-get install libcurl4-gnutls-dev

sudo apt-get install libpng12-0

sudo apt-get install libpng12-dev

sudo apt-get install libjpeg62

sudo apt-get install libjpeg62-dev

sudo apt-get install libfreetype6

sudo apt-get install libfreetype6-dev

sudo apt-get install libmcrypt4

sudo apt-get install libmcrypt-dev

sudo apt-get install zlib1g-dev

sudo apt-get install libtidy-dev

注意:

如果是RH,需要:

复制代码 代码示例:

yum -y install curl-devel

yum install libjpeg-devel

yum install libpng-devel

yum install freetype-devel

yum install -y libmcrypt-devel.x86_64

yum install -y libxml2-devel.x86_64

yum install -y bzip2-devel.x86_64

yum install libtool-ltdl-devel (在 make的时候会出现:/usr/bin/ld: cannot find -lltdl)

yum install autoconf

yum install -y libtidy-devel.x86_64

编译、安装

复制代码 代码示例:

./configure  --prefix=/usr/local/php-5.3.3 --with-gettext --with-mysql=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-curl --with-freetype-dir --enable-gd-native-ttf --enable-mbstring --enable-sockets --with-mcrypt --with-pdo-mysql=mysqlnd --enable-fpm --with-zlib --enable-zip --with-bz2 --enable-bcmath --with-tidy

make

make install

编译安装完成之后,还需要对php-fpm 进行配置,因为php5.3不再需要打php-fpm补丁,所以以前控制php-fpm(启动、重启)的方式需要改变。操作步骤如下:

从源码包复制:

复制代码 代码示例:

sudo path/to/php-source/folder/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

sudo chmod a+x /etx/init.d/php-fpm

然后,即可通过 /etc/init.d/php-fpm (start|stop|force-quit|restart|reload) 进行控制

一般扩展安装

安装memcached:

复制代码 代码示例:

wget http://pecl.php.net/get/memcache-2.2.5.tgz

tar -xvf memcache-2.2.5.tgz

cd memcache-2.2.5

/usr/local/php-5.3.3/bin/phpize

./configure --with-php-config=/usr/local/php-5.3.3/bin/php-config

make

make install

安装solr:

复制代码 代码示例:

wget http://pecl.php.net/get/solr-0.9.11.tgz

tar -xvf solr-0.9.11.tgz

cd solr-0.9.11

/usr/local/php-5.3.3/bin/phpize

./configure --with-php-config=/usr/local/php-5.3.3/bin/php-config

make

make install

安装xcache:

复制代码 代码示例:

wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.bz2

tar -xjvf xcache-1.3.0.tar.bz2

cd xcache-1.3.0

/usr/local/php-5.3.3/bin/phpize

./configure --with-php-config=/usr/local/php-5.3.3/bin/php-config

make

make install

配置php_ini文件:

复制代码 代码示例:

expose_php = off

error_reporting = E_ALL

display_errors = On

short_open_tag = On

extension=memcache.so

extension=xcache.so

extension=solr.so bbs需要

;log_errors = on

error_log = syslog #说明:linux系统可以使用这个,把errorlog 输出到syslog中

date.timezone = Asia/Shanghai

到这里,php5.3就安装成功了,希望以上的教程,对大家有所帮助。

项目中要用到zend Optimizer,但是目前只支持php5.2,Ubuntu默认安装php版本为5.3,找了好多 方法,终于借助下面这篇文章的方法成功的安装了5.2及5.3两个版本的php 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值