编译安装php5.6.2
编译安装php5.6.2
1. 前期准备工作 php相关: libiconv, mhash, mcrypt, libmcrypt, memcache, ImageMagick, imagick # mkdir /home/download && cd /home/download # yum install gcc pcre pcre-devel gcc-c++ autoconf libxml2 libxml2-devel zlib zlib-devel glibc libjpeg libjpeg-devel libpng libpng-devel glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers freetype freetype-devel 【libiconv】 下载LIBICONV 1.14 并安装 Libiconv URL: http://ftp.gnu.org/pub/gnu/libiconv/ # wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz # tar zxvf libiconv-1.14.tar.gz && cd libiconv-1.14 # ./configure --prefix=/usr/local && make && make install # cd .. 【mhash】 下载 MHASH 0.9.9.9 并安装 URl: http://sourceforge.net/projects/mhash/ # wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2 # tar jxvf mhash-0.9.9.9.tar.bz2 && cd mhash-0.9.9.9 # ./configure && make && make install # /sbin/ldconfig # cd .. 【libmcrypt】 下载 LIBMCRYPT 2.5.8 并安装 URL: http://sourceforge.net/projects/mcrypt/files/Libmcrypt/ # wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz # tar zxf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8 # ./configure && make && make install # /sbin/ldconfig # cd libltdl/ # ./configure --enable-ltdl-install && make && make install # cd ../../ 创建系统软连接 # ln -s /usr/local/lib/libmcrypt.* /usr/lib/ # ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config # ln -s /usr/local/lib/libmhash.* /usr/lib/ 【mcrypt】 下载 MCRYPT 2.6.8 并安装 myrypt URL: http://sourceforge.net/projects/mcrypt/?source=dlpaz # wget http://sourceforge.net/projects/mcrypt/files/latest/download?source=dlpaz -O mcrypt-2.6.8.tar.gz # tar zxf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8 # ./configure && make && make install # /sbin/ldconfig # cd .. 2. 编译安装php # wget http://php.net/get/php-5.6.2.tar.gz/from/this/mirror -O php-5.6.2.tar.gz # tar zxvf php-5.6.2.tar.gz && cd php-5.6.2 # ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-pdo-sqlite --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock --with-mcrypt --with-mhash --with-iconv-dir=/usr/local --with-gd --with-gettext --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir=/usr --with-curl --with-xmlrpc --with-zlib --with-pear --with-openssl --with-libdir --with-kerberos --enable-cgi --enable-fpm --enable-pdo --enable-opcache --enable-mbstring --enable-gd-native-ttf --enable-xml --enable-exif --enable-zip --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-json --enable-bcmath --enable-calendar --enable-ftp --enable-inline-optimization --enable-pcntl --enable-mbregex --disable-rpath # make ZEND_EXTRA_LIBS=‘-liconv‘ # make install # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # chmod +x /etc/init.d/php-fpm # chkconfig php-fpm on # ln -s /usr/local/php/bin/* /usr/bin/ # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf # cp php.ini-production /usr/local/php/etc/php.ini # cd .. 3. 插件和对应的服务的安装 【memcached】 # yum install memcached # echo "/usr/bin/memcached -d -m 512 -l localhost -u root" >> /etc/rc.local # memcached -d -m 512 -l localhost -u root ============ php插件memcache # wget http://pecl.php.net/get/memcache -O memcache-3.0.8.tar.gz # tar zxvf memcache-3.0.8.tar.gz && cd memcache-3.0.8/ # /usr/local/php/bin/phpize # ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config # make && make install # cd .. 【ImageMagick】 # yum install ImageMagick-devel ============ php插件imagick # wget http://pecl.php.net/get/imagick -O imagick.tar.gz # tar zxvf imagick.tar.gz && cd imagick-3.3.0RC1/ # /usr/local/php/bin/phpize # ./configure --with-php-config=/usr/local/php/bin/php-config # make && make install # cd .. 【gearmand】 安装gearmand # yum -y install boost-devel # wget https://launchpad.net/gearmand/1.0/1.0.6/+download/gearmand-1.0.6.tar.gz # tar zxvf gearmand-1.0.6.tar.gz && cd gearmand-1.0.6 # ./configure # make && make install # cd .. 启动: # mkdir -p /usr/local/var/log # gearmand -L 127.0.0.1 -d # echo "/usr/local/sbin/gearmand -L 127.0.0.1 -d" >> /etc/rc.local ============ php插件gearman # wget http://pecl.php.net/get/gearman-0.8.0.tgz # tar zxvf gearman-0.8.0.tgz && cd gearman-0.8.0 # /usr/local/php/bin/phpize # ./configure --with-php-config=/usr/local/php/bin/php-config # make && make install # cd .. 4. 配置文件 【php.ini】 # vim /usr/local/php/etc/php.ini expose_php = Off max_execution_time = 300 max_input_time = 600 post_max_size = 100M date.timezone = Asia/Shanghai 增加到文件末尾: extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/" extension = "memcache.so" extension = "imagick.so" extension = "gearman.so" zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so" opcache.enable=1 opcache.enable_cli=1 opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.save_comments=0 opcache.fast_shutdown=1 【php-fpm.conf】 # vim /usr/local/php/etc/php-fpm.conf user = www group = www access.log = /usr/local/php/var/log/$pool.access.log access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" slowlog = /usr/local/php/var/log/$pool.log.slow service php-fpm start
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。