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 gcc gcc-c++ openssl openssl-devel libxml2
yum install -y libxml2-devel
yum install -y libjpeg libjpeg-devel
yum install -y libpng-devel
yum install -y libpng
yum 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

 

 查看支持哪些模块

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

 扩展

 

php编译第三方扩展模块:

1,准备模块源码包。解压
2,进入源码包执行 /usr/local/php/bin/phpize
3,执行 ./configure --with-php-config=/usr/local/php/bin/php-config (php-config编译完就有该文件)
4,安装 make && make install
5,在php.ini中增加相应的配置(写法) extension=xxxxx.so 找包地址: https://pecl.php.net/package/redis

 

posted on 2021-09-23 10:28  华华中  阅读(148)  评论(0编辑  收藏  举报

导航