Ubuntu下编译安装PHP

Ubuntu下不管是做什么都很方便,废话少说,准备开始

apt-get install build-essential

需要用到的其他软件包

apt-get install libxml2-dev libcurl4-openssl-dev libbz2-dev libpng-dev libfreetype6-dev libmcrypt-dev libmhash-dev libmysqlclient-dev libxslt1-dev libjpeg62-dev libltdl-dev

下载PHP源码

wget -O /usr/src/php-5.2.17.tar.gz http://cn.php.net/get/php-5.2.17.tar.gz/from/this/mirror

编译参数包含了常用的模块

tar -zxvf php-5.2.17.tar.gz
cd php-5.2.17/
./configure --prefix=/usr/local/php_5.2.17 --with-mysql --with-mysqli --enable-fastcgi --enable-sockets --enable-ftp --enable-zip --enable-mbstring --enable-mbregex --enable-calendar --with-curl   --with-curlwrappers --disable-debug --enable-inline-optimization --with-gd --with-kerberos   --with-gettext --enable-force-cgi-redirect --with-jpeg-dir --with-png-dir --with-bz2 --enable-pcntl --with-iconv --with-mcrypt --with-pdo-mysql --with-freetype-dir --enable-path-info-check --with-openssl --with-xsl --enable-exif --with-mhash --enable-soap --without-pear --with-zlib
make
make install

大功告成

# /usr/local/php_5.2.17/bin/php -v
PHP 5.2.17 (cli) (built: .....)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*


*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>