读书人

CentOS5.5上编译装配 PHP 5.3.6

发布时间: 2012-06-28 15:20:04 作者: rapoo

CentOS5.5上编译安装 PHP 5.3.6

CentOS 5.6一直没发布,CentOS 5.5的PHP5.1.6不支持json/hash,因为正研究Postfix+Dovecot邮件系统,webmail采用的 RoundCube? 新版本(v0.5)要求PHP版本不小于5.2.1,于是决定编译安装最新版PHP。PHP前几天被入侵据说v5.3.6代码被污染,不过用来做研究测试应该没问题。

?

    先卸载本机已经安装的PHP包,这些软件包将会通过接下来的编译方式安装,安装必须软件
    # yum remove php php-\*

    如果不需要pgsql数据库则可以去掉postgresql相关包
    # yum install -y httpd-devel libtool-ltdl libtool-ltdl-devel openssl-devel curl-devel? \
    ????? libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
    ????? libc-client libc-client-devel? gd gd-devel libmcrypt libmcrypt-devel \
    ????? sqlite sqlite-devel mysql-devel libicu libicu-devel pcre-devel \
    ????? postgresql84 postgresql84-libs postgresql84-server postgresql84-devel \
    如果不安装 libtool-ltdl-devel编译时会出错,所以要么安装这个包要么执行以下命令:
    # cd /usr/lib
    # ln -s libltdl.so.3.1.4 libltdl.so
    libicu是 --enable-intl?????????? Enable internationalization support 需要的包

    如果需要pspell拼写支持需要下载编译安装以下两个文件( ./configure && make && make install)
    ftp://ftp.gnu.org/gnu/aspell/aspell-0.60.6.tar.gz
    ftp://ftp.gnu.org/gnu/aspell/dict/en/aspell6-en-7.1-0.tar.bz2
    网站是 http://aspell.net/



    下载源代码到 src 目录并解压:
    # cd /usr/local/src
    # wget http://cn.php.net/get/php-5.3.6.tar.bz2/from/this/mirror
    # tar -xjf php-5.3.6.tar.bz2

    配置安装参数
    ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu \--target=i686-redhat-linux-gnu  --with-apxs2=/usr/sbin/apxs \--prefix=/usr/local --exec-prefix=/usr/local --with-exec-dir=/usr/local/bin \--sysconfdir=/etc  --libdir=/usr/local/lib/php --with-libdir=lib \--sbindir=/usr/local/sbin --sharedstatedir=/usr/com --datadir=/usr/local/share \--includedir=/usr/local/include --libexecdir=/usr/local/libexec \--localstatedir=/var  \--mandir=/usr/local/share/man --infodir=/usr/local/share/info \--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d \--with-pic  --with-curl=shared  --with-freetype-dir --with-png-dir  \--with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-png-dir \--with-openssl --with-layout=GNU --with-libxml-dir \--with-pcre-regex=/usr \--with-mcrypt=shared --with-mhash --with-zlib --with-bz2=shared \--with-pdo-mysql --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock \--with-pgsql --with-pdo-pgsql --with-sqlite=shared --with-pdo-sqlite=shared \--enable-sqlite-utf8 --with-kerberos --with-imap --with-imap-ssl \--with-pear --with-gd --enable-gd-native-ttf --enable-calendar=shared \--enable-exif --enable-ftp --enable-sockets --enable-bcmath \--enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-intl \--enable-mbstring --enable-zend-multibyte --enable-zip \--without-unixODBC --disable-tokenizer \--enable-mbregex --with-pspell=/usr/local \ 
    如果未安装pspell,则删除最后一行。
    非RHEL/CentOS系统可以省略 --build,--host,--target 参数,程序会自动判断(LINUX一般为i686-pc-linux-gnu)。如果没安装pgsql或者不需要pgsql的支持可以删除相关参数(共2个)。 bz2, calendar, curl, mcrypt, pdo_sqlite, sqlite 这些模块采用动态编译,可采用下面将会提到的方法加载。

    编译并安装
    # make && make install
    安装结果摘要,里面有几个主要的安装路径变量
    <?phpphpinfo();?>?重启apache服务
    # service httpd restart
    然后在浏览器打开 http://localhost/phpinfo.php 或者 http://serv-ip/phpinfo.php? 文件查看php配置状况,这里ip地址为服务器地址


?

?

?

?

.

读书人网 >操作系统

热点推荐