编译安装php-5.5.15
一、环境
创新互联是一家朝气蓬勃的网站建设公司。公司专注于为企业提供信息化建设解决方案。从事网站开发,网站制作,网站设计,网站模板,微信公众号开发,软件开发,微信平台小程序开发,十年建站对成都展览展示等多个领域,拥有多年设计经验。
系统:CentOS 6.4x64
IP: 192.168.3.48
二、安装基础软件包
[root@lnmp-test ~]# yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libxslt-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel bzip2 bzip2-devel -y
三、安装libiconv
#下载软件 [root@lnmp-test ~]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz [root@lnmp-test ~]# tar xf libiconv-1.14.tar.gz [root@lnmp-test ~]# cd libiconv-1.14 [root@lnmp-test libiconv-1.14]# ./configure [root@lnmp-test libiconv-1.14]# make && make install
四、安装libmcrypt
#下载软件 [root@lnmp-test ~]# wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download [root@lnmp-test ~]# tar xf libmcrypt-2.5.8.tar.gz [root@lnmp-test ~]# cd libmcrypt-2.5.8 [root@lnmp-test libmcrypt-2.5.8]# ./configure [root@lnmp-test mhash-0.9.9.9]# make && make install [root@lnmp-test mhash-0.9.9.9]# cd libltdl/ [root@lnmp-test libltdl]# ./configure --enable-ltdl-install [root@lnmp-test libltdl]# make && make install #安装mhash [root@lnmp-test ~]wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download [root@lnmp-test ~]tar xf mhash-0.9.9.9.tar.gz [root@lnmp-test ~]cd mhash-0.9.9.9 [root@lnmp-test mhash-0.9.9.9] ./configure [root@lnmp-test mhash-0.9.9.9] make && make install #配置软链接信息 [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 [root@lnmp-test mhash-0.9.9.9]# ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
五、安装mcrypt
#下载软件 [root@lnmp-test ~]# wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download [root@lnmp-test ~]# tar xf mcrypt-2.6.8.tar.gz [root@lnmp-test ~]# cd mcrypt-2.6.8 [root@lnmp-test mcrypt-2.6.8]# /sbin/ldconfig [root@lnmp-test mcrypt-2.6.8]# ./configure [root@lnmp-test mcrypt-2.6.8]# make && make install [root@lnmp-test mcrypt-2.6.8]# /sbin/ldconfig
六、安装php
#下载php软件 [root@lnmp-test ~]# wget http://cn2.php.net/distributions/php-5.5.24.tar.gz [root@lnmp-test php-5.5.24]# ./configure \ > --prefix=/usr/local/php-5.5.24 \ > --with-config-file-path=/usr/local/php-5.5.24/etc \ > --enable-fpm \ > --with-fpm-user=www \ > --with-fpm-group=www \ > --with-MySQL=mysqlnd \ > --with-mysqli=mysqlnd \ > --with-pdo-mysql=mysqlnd \ > --with-iconv-dir \ > --with-freetype-dir \ > --with-jpeg-dir \ > --with-png-dir \ > --with-zlib \ > --with-libxml-dir=/usr \ > --enable-xml \ > --disable-rpath \ > --enable-bcmath \ > --enable-shmop \ > --enable-sysvsem \ > --enable-inline-optimization \ > --with-curl \ > --enable-mbregex \ > --enable-mbstring \ > --with-mcrypt \ > --enable-ftp \ > --with-gd \ > --enable-gd-native-ttf \ > --with-openssl \ > --with-mhash \ > --enable-pcntl \ > --enable-sockets \ > --with-xmlrpc \ > --enable-zip \ > --enable-soap \ > --with-gettext \ > --disable-fileinfo \ > --with-kerberos [root@lnmp-test php-5.5.24]# make ZEND_EXTRA_LIBS='-liconv' [root@lnmp-test php-5.5.24]# make install [root@lnmp-test php-5.5.24]# make && make install #配置软连接信息 [root@lnmp-test php-5.5.24]# ln -s /usr/local/php-5.5.24 /usr/local/php [root@lnmp-test php-5.5.24]# ln -s /usr/local/php/bin/php /usr/bin/php [root@lnmp-test php-5.5.24]# ln -s /usr/local/php/bin/pecl /usr/bin/pec [root@lnmp-test php-5.5.24]# ln -s /usr/local/php/bin/pear /usr/bin/pear [root@lnmp-test php-5.5.24]# ln -s /usr/local/php/bin/phpize /usr/bin/phpize [root@lnmp-test php-5.5.24]# ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm #复制配置文件 [root@lnmp-test php-5.5.24]# cp php.ini-production /usr/local/php/etc/php.ini #[root@lnmp-test php-5.5.24]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@lnmp-test php-5.5.24]# cat >/usr/local/php/etc/php-fpm.conf<[global] > pid = /usr/local/php/var/run/php-fpm.pid > error_log = /usr/local/php/var/log/php-fpm.log > log_level = notice > > [www] > listen = /tmp/php-cgi.sock > listen.backlog = -1 > listen.allowed_clients = 127.0.0.1 > listen.owner = www > listen.group = www > listen.mode = 0666 > user = www > group = www > pm = dynamic > pm.max_children = 10 > pm.start_servers = 2 > pm.min_spare_servers = 1 > pm.max_spare_servers = 6 > request_terminate_timeout = 100 > request_slowlog_timeout = 0 > slowlog = var/log/slow.log > EOF #[root@lnmp-test php-5.5.24]# sed -i 's@;pid = run/php-fpm.pid@pid = run/php-fpm.pid@' /usr/local/php/etc/php-fpm.conf [root@lnmp-test php-5.5.24]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@lnmp-test php-5.5.24]# chmod +x /etc/init.d/php-fpm [root@lnmp-test php-5.5.24]# /etc/init.d/php-fpm start Starting php-fpm done [root@lnmp-test php-5.5.24]# ps aux |grep php root 7992 0.0 0.4 203208 4864 ? Ss 13:50 0:00 php-fpm: master process (/usr/local/php-5.5.24/etc/php-fpm.conf) www 7993 0.0 0.4 203208 4284 ? S 13:50 0:00 php-fpm: pool www www 7994 0.0 0.4 203208 4284 ? S 13:50 0:00 php-fpm: pool www root 7999 0.0 0.0 103248 836 pts/0 S+ 13:50 0:00 grep php
七、安装zendopcache
# 下载软件 [root@lnmp-test ~]# wget http://pecl.php.net/get/zendopcache-7.0.3.tgz [root@lnmp-test ~]# tar xf zendopcache-7.0.3.tgz [root@lnmp-test ~]# cd zendopcache-7.0.3 [root@lnmp-test zendopcache-7.0.3]# phpize [root@lnmp-test zendopcache-7.0.3]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@lnmp-test zendopcache-7.0.3]# make && make install #安装完成后会出现如下信息 Installing shared extensions: /usr/local/php-5.5.24/lib/php/extensions/no-debug-non-zts-20121212/ [root@lnmp-test zendopcache-7.0.3]# cat >> /usr/local/php/etc/php.ini<[opcache] > zend_extension=opcache.so > opcache.memory_consumption=128 > opcache.interned_strings_buffer=8 > opcache.max_accelerated_files=4000 > opcache.revalidate_freq=60 > opcache.fast_shutdown=1 > opcache.enable_cli=1 > EOF #重启php-fpm服务即可 [root@lnmp-test zendopcache-7.0.3]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done #将php-fpm添加到开机自动启动 [root@lnmp-test zendopcache-7.0.3]# chkconfig --add php-fpm [root@lnmp-test zendopcache-7.0.3]# chkconfig php-fpm on
标题名称:编译安装php-5.5.15
转载注明:http://azwzsj.com/article/jcdosi.html