linux 下php7的安装笔记

下载,解压
tar zxvf php-7.1.10.tar.gz

  

 
cd php-7.1.10
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/sbin/apxs \
--with-config-file-path=/usr/local/php \
--with-pdo-mysql
 
./configure --prefix=/usr/local/php \
--enable-sockets=shared  \
--enable-fpm \
--with-pdo-mysql=shared,mysqlnd \

  

 

配置php.ini

cp php.ini-* /usr/local/php/

  

 

生成php.ini

cp php.ini-development /usr/local/php/php.ini

  

 

修改httpd.conf

LoadModule php7_module modules/libphp7.so
<IfModule mod_php7.c>
AddType application/x-httpd-php .php
</IfModule>
 

  

/usr/lib64/httpd/modules/libphp7.so

  

 

重启Apache

 
service httpd restart

  

 

#**************************************************第二次记录************************************

下载安装包

2,安装依赖包

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libicu-devel libxslt-devel

  

3,解压进入
tar zxvf php-7.2.2.tar.gz cd php-7.2.2

  

4,配置
./configure \
--prefix=/usr/local/php \
--exec-prefix=/usr/local/php \
--bindir=/usr/local/php/bin \
--sbindir=/usr/local/php/sbin \
--includedir=/usr/local/php/include \
--libdir=/usr/local/php/lib/php \
--mandir=/usr/local/php/php/man \
--with-config-file-path=/usr/local/php/etc \
--with-openssl \
--enable-mbstring \
--enable-fpm

  

5,编译安装
make && make install
 
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 
chmod +x /etc/init.d/php-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf 
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf 

  

6,配置系统变量
vim /etc/profile.d/php.sh 
export PATH=$PATH:/usr/local/php/bin/:/usr/local/php/sbin/
:wq!
source /etc/profile.d/php.sh 
service php-fpm start

  

  7,查看端口
netstat -tnl

  

 

上一篇:mac 配置php-fpm


下一篇:Nginx系列教程(六)| 手把手教你搭建 LNMP 架构并部署天空网络电影系统