centos7源码安装php-7.0.3

centos7源码安装php-7.0.3

 

1、创建安装包目录,下载并解压安装包

mkdir /data
cd /data
wget https://www.php.net/distributions/php-7.0.3.tar.gz tar -xvf php-7.0.3.tar.gz

2、安装epel

sudo yum install -y epel-release
sudo sed -e 's|^metalink=|#metalink=|g' \
-e 's|^#baseurl=https\?://download.fedoraproject.org/pub/epel/|baseurl=https://mirrors.ustc.edu.cn/epel/|g' \
-i.bak \
/etc/yum.repos.d/epel.repo
yum makecache

3、解决依赖关系

yum install -y libxml2yum install -y libxml2-develyum install -y libjpeg libjpeg-develyum install -y libpng-develyum install -y libpngyum install -y libXpm-devel
yum install -y freetype-devel
yum install -y libmcrypt
yum install -y libmcrypt-devel
yum install -y bison bison-devel

4、编译安装

./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/php.d \
--disable-ipv6 \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-ftp \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-mysqlnd \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-static \
--enable-sysvsem \
--enable-wddx \
--enable-xml \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-freetype-dir \
--with-xpm-dir \
--with-png-dir \
--with-gettext \
--with-iconv \
--with-libxml-dir \
--with-mcrypt \
--with-mhash \
--with-mysqli \
--with-pdo-mysql \
--with-pear \
--with-openssl \
--with-xmlrpc \
--with-zlib \
--disable-debug \
--disable-phpdbg
make && make install

5、安装完成之后还要进行简单配置

在/usr/local/php/etc下添加配置文件

php-fpm.conf 和 php.ini

 

(1)复制启动脚本

cp /data/php-7.0.3/sapi/fpminit.d.php-fpm  /etc/init.d/php-fpm
chmod a+x /etc/init.d/php-fpm

(2)创建wwwlogs

mkdir -p /home/wwwlogs

(3)启动php

/etc/init.d/php-fpm  start
ps -ef | grep php

centos7源码安装php-7.0.3

 

 查看支持哪些模块

/usr/local//php/bin/php -m

 

上一篇:HDLBits第十一章练习及答案


下一篇:Ubuntu20.04 FTP服务器的搭建