咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
1.安装必要插件和依赖
rpm -ivh http://www.landui.com/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum groupinstall Development Tools
yum install libmhash-devel
yum install libmhash
yum install libicu-devel
yum install -y gcc gcc-c++ make gmp-devel libc-client-devel zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2.安装libiconv
wget http://www.landui.com/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/usr/local/libiconv
make && make install
如果出现错误提示如:No targets specified and no makefile found. Stop
那么先事先安装yum install gcc build-essential
3.安装libmcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
./configure
make && make install
如果出现错误提示:make: *** [sapi/cli/php] Error 1
解决办法make ZEND_EXTRA_LIBS=-liconv
4.在执行./configure命令的时候会自动需找/usr/lib目录中所需内容,如果是64为系统那么可以做如下软链接操作:
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
ln -s /usr/lib64/libpng.so /usr/lib/libpng.so
ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
ln -s /usr/lib64 /usr/kerberos/lib
5.cp -frp /usr/lib64/libldap* /usr/lib/
6.cp -rp /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so #注意如果出现错误提示:文件不存在,那么查看版本有的是libmysqlclient.so.16.0.0
7.下载php5.2源码进行安装
(1)地址:http://www.landui.com/distributions/php-5.2.17.tar.gz
(2)tar -zxvf php-5.2.17.tar.gz
(3)cd php-5.2.17
(4)./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-config-file-scan-dir=/usr/local/php/php.d --with-mhash=/usr --with-icu-dir=/usr --with-bz2 --with-curl --with-freetype-dir --with-gd --with-gettext --with-gmp --with-imap --with-imap-ssl --with-jpeg-dir --with-kerberos --with-ldap --with-mcrypt --with-openssl --without-pear --with-pdo-mysql --with-png-dir --with-xmlrpc --with-zlib --enable-bcmath --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-json --enable-mbstring --enable-pcntl --enable-session --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-tokenizer --enable-wddx --enable-xml --enable-zip --disable-fileinfo
在执行命令的时候如果出现错误,要逐一排除
(5)make && make install
8.下面可以进入到/usr/local/php/bin目录中进行检查测试是否编译安装成功
./php -v #查看版本信息
./php -i | grep configure
9.接下来到httpd.conf文件中添加AddType application/x-httpd-php .php
10.接下来我们可以建立站点了.测试一下index.php