Centos7 编译安装 PHP7

2025-05-24 07:43:19

1、安装编译工具和扩展库yum -y install libxml2 libxml2-devel gd gd-devel

Centos7 编译安装 PHP7

2、下载php7并解压

Centos7 编译安装 PHP7

3、编译安装php73.1 ./configure --prefix=/usr/local/php --with-config-fi造婷用痃le-path=/usr/local/php/etc --with-gd --enable-pdo --with-openssl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --enable-mbstring --enable-zip --enable-fpm3.2 make && make install

Centos7 编译安装 PHP7
Centos7 编译安装 PHP7

4、配置php7

Centos7 编译安装 PHP7
Centos7 编译安装 PHP7
Centos7 编译安装 PHP7

5、配置nginx服务器4.1cp php.ini-production /usr/local/php/etc/php.ini4.2cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf4.3cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf4.4cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm4.5chmod +x /etc/init.d/php-fpm4.6ln -s /etc/init.d/php-fpm /usr/bin/

Centos7 编译安装 PHP7
Centos7 编译安装 PHP7

6、启动nginx和php服务器6.1nginx - s start6.2 php-fpm start6.3创建phpinfo()测试文件

Centos7 编译安装 PHP7
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢