时间:2021-05-28
1.首先安装依赖包:
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel2.下载PHP压缩包并解压:
wget http://php.net/distributions/php-7.1.0.tar.gztar -zxvf php-7.1.0.tar.gzcd php-7.1.03.编译安装,编译的时候可能会出现各种报错情况,下一篇主要写编译是常见的错误及解决办法:
./configure \--prefix=/usr/local/php \--with-config-file-path=/etc \--enable-fpm \--enable-inline-optimization \--disable-debug \--disable-rpath \--enable-shared \--enable-soap \--with-libxml-dir \--with-xmlrpc \--with-openssl \--with-mcrypt \--with-mhash \--with-pcre-regex \--with-sqlite3 \--with-zlib \--enable-bcmath \--with-iconv \--with-bz2 \--enable-calendar \--with-curl \--with-cdb \--enable-dom \--enable-exif \--enable-fileinfo \--enable-filter \--with-pcre-dir \--enable-ftp \--with-gd \--with-openssl-dir \--with-jpeg-dir \--with-png-dir \--with-zlib-dir \--with-freetype-dir \--enable-gd-native-ttf \--enable-gd-jis-conv \--with-gettext \--with-gmp \--with-mhash \--enable-json \--enable-mbstring \--enable-mbregex \--enable-mbregex-backtrack \--with-libmbfl \--with-onig \--enable-pdo \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-zlib-dir \--with-pdo-sqlite \--with-readline \--enable-session \--enable-shmop \--enable-simplexml \--enable-sockets \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-wddx \--with-libxml-dir \--with-xsl \--enable-zip \--enable-mysqlnd-compression-support \--with-pear \--enable-opcache4.编译成功后安装:
make && make install
5.安装成功后配置环境变量:
为了使用方便,可以在 /etc/profile文件末尾添加php环境变量 :
PATH=$PATH:/usr/local/php/bin export PATH保存后刷新环境变量:
source /etc/profile #更新
查看环境变量:
echo $PATH
看到php环境变量的路径后,以后就可以直接使用php命令了,查看php版本:
php -v
6.现在的PHP没有.ini文件和配置文件,还需要配置PHP-FPM:
cp php.ini-production /etc/php.inicp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.confcp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod +x /etc/init.d/php-fpmphp-fpm的启动、停止和重启:
service php-fpm start #启动service php-fpm stop #停止service php-fpm restart #重启总结
以上所述是小编给大家介绍的CentOS7编译安装php7.1的教程详解,希望对大家有所帮助,如果大家有任何疑问欢迎给留言,小编会及时回复大家的!
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
前言本文主要介绍的是基于centos7进行yum安装lnmp(linux+nginx+php7.1+mysql5.7)的相关教程,文中将一步步介绍的非常详细,下
关于GCC在CentOS下通过yum安装默认版本号,CentOS5是4.1.2;CentOS6是4.4.7;CentOS7是4.8.3。很多时候在编译安装软件都
1常规错误的yum安装方法:在前文中记述了CentOS6.5系统中通过yum方式快速地搭建了LNMP环境,那么是否也能在CentOS7或CentOS7.1系统中
centos7安装MariaDB教程,分享给大家1.centos7现状: 新系统无法再使用yuminstallmysql-server来安装mysql,因为已
目录安装CentOS7配置静态IP通过vi编辑该文件安装centos7这里我们要安装centos764位,所以选择centos764位配置我们点击存储后,vmw