php版本7.2.6
备用安装包下载地址:php-7.2.6.tar.gz
一、更改yum源
安装阿里云yum源
1 2 3 |
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo |
二、下载安装包并解压
1 2 |
wget http://cn2.php.net/distributions/php-7.2.6.tar.gz tar zxf php-7.2.6.tar.gz -C /usr/local/src/ |
三、安装依赖
1 |
yum -y install libxml2 libxml2-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libc-client-devel libxslt-devel |
四、编译安装
1. 切换目录
1 |
cd /usr/local/src/php-7.2.6 |
2.编译
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 40 41 42 43 44 45 46 47 48 49 50 |
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-iconv-dir \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-curl \ --with-gd \ --with-zlib \ --with-xmlrpc \ --with-openssl \ --with-gettext \ --with-mhash \ --with-libxml-dir=/usr \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --with-libdir=lib64 \ --with-pcre-regex \ --with-ldap-dir \ --with-imap \ --with-imap-ssl \ --with-kerberos \ --with-xsl \ --with-bz2 \ --enable-xml \ --enable-fpm \ --enable-ftp \ --enable-exif \ --enable-bcmath \ --enable-soap \ --enable-shmop \ --enable-sysvsem \ --enable-sockets \ --enable-inline-optimization \ --enable-mbregex \ --enable-mbstring \ --enable-pcntl \ --enable-zip \ --enable-session \ --enable-ctype \ --enable-calendar \ --disable-rpath \ --enable-opcache \ --enable-gd-native-ttf \ --with-zlib-dir \ --enable-mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ && make && make install |
3. 配置php配置文件
移动php配置文件的位置,并修改名称
1 |
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.conf |
复制php.ini文件
1 |
cp /usr/local/src/php-7.2.6/php.ini-production /usr/local/php/etc/php.ini |
4. 启动脚本
复制php启动脚本到/etc/init.d/
1 |
cp /usr/local/src/php-7.2.6/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm |
添加执行权限,添加到启动项并设置开机自启动。
1 2 3 |
chmod +x /etc/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on |
5. 启动php-fpm
1 |
/etc/init.d/php-fpm start |
转载请注明:百分数 » centos7编译php7.2
责任声明: 本站一切资源仅用作交流学习,请勿用作商业或违法行为!如造成任何后果,本站概不负责!