本文共 3055 字,大约阅读时间需要 10 分钟。
安装php需要的软件。
1 2 3 | yum -y install gcc gcc-c++ libzip-devel libxml2-devel libiconv libjpeg-devel libpng-devel yum -y install gdgd-devel bzip2 -devel curl-devel freetype-devel zlib-devel glibc-devel glib2-devel yum -y install libtool-ltdl-devel pcre-devel libmcrypt-devel mhash-devel libxslt-devel gettext-devel |
安装libiconv库
1 2 3 4 5 6 | wget http: //ftp .gnu.org /pub/gnu/libiconv/libiconv-1 .13. tar .gz tar zxf libiconv-1.13. tar .gz cd libiconv-1.13 . /configure --prefix= /usr/local/libiconv make && make install cd .. |
安装PHP
1 2 3 4 5 | cd /home/darren/tools #需要手动下载php,附件中也有 http: //cn2 .php.net /get/php-5 .6.30. tar .gz /from/this/mirror tar zxf php-5.6.30. tar .gz cd php-5.6.30 |
1 | ############## |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | . /configure --prefix= /usr/local/php \ -- enable -mysqlnd \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-iconv- dir = /usr/local/libiconv \ --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 \ --with-mcrypt \ --with-curlwrappers \ -- enable -mbregex \ -- enable -fpm \ -- enable -mbstring \ --with-gd \ -- enable -gd-native-ttf \ --with-openssl \ --with-mhash \ -- enable -pcntl \ -- enable -sockets \ --with-xmlrpc \ -- enable -zip \ -- enable -soap \ -- enable -short-tags \ -- enable -zend-multibyte \ -- enable -static \ --with-xsl \ -- enable - ftp \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ |
1 | make && make install |
################################################################
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #复制php配置文件php.ini cp php.ini-production /usr/local/php/lib/php .ini #复制fastcgi配置文件php-fpm.conf cd /usr/local/php/etc/ cp php-fpm.conf.default php-fpm.conf ################################################################# /usr/local/php/sbin/php-fpm -t #检查语法 /usr/local/php/sbin/php-fpm #启动php-fpm cp sapi /fpm/init .d.php-fpm /etc/init .d /php-fpm #拷贝启动脚本 chkconfig --add php-fpm #增加到开机启动项 chkconfig php-fpm on #设置开机启动 |
1 2 | ###################################### 一键安装php脚本: |
附另一个生产环境编译参数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | . /configure --prefix= /usr/local/php \ --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 \ -- enable -xml \ --disable-rpath \ -- enable -bcmath \ -- enable -shmop \ -- enable -sysvsem \ -- enable -inline-optimization \ --with-curl \ --with-mcrypt \ --with-curlwrappers \ -- enable -mbregex \ -- enable -fpm \ -- enable -mbstring \ --with-gd \ -- enable -gd-native-ttf \ --with-openssl \ --with-mhash \ -- enable -pcntl \ -- enable -sockets \ --with-xmlrpc \ -- enable -zip \ -- enable -soap \ --without-pear |
转载地址:http://zjsoa.baihongyu.com/