一、下载php7.3的源码

https://www.php.net/downloads.php

下载php-7.3.4.tar.gz

二、安装gcc,gcc-c++,kernel-devel

yum -y install gcc gcc-c++ kernel-devel

  

三、安装php需要的依赖库

yum -y install wget pcre pcre-devel openssl openssl-devel libicu-devel autoconf libjpeg libjpeg-devel \
libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap \
openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel \
gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline \
readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel

四、创建用户和组,并解压

groupadd www
useradd -g www www
tar xf php-7.3.4.tar.gz
cd php-7.3.4

  

五、进行编译安装

php的路径 --prefix 和配置文件 --with-config-file-path 路径大家可以自行设置

./configure --prefix=/data/nmp/php \
--with-config-file-path=/data/nmp/php/etc \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--with-ldap=shared \
--with-gdbm \
--with-pear \
--with-gettext \
--with-curl \
--with-xmlrpc \
--with-openssl \
--with-mhash \
--with-gd \
--enable-fpm \
--enable-mysqlnd \
--enable-mysqlnd-compression-support \
--enable-xml \
--enable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--enable-ftp \
--enable-gd-jis-conv \
--enable-pcntl \
--enable-sockets \
--enable-zip \
--enable-soap \
--enable-fileinfo \
--enable-opcache \
--enable-maintainer-zts \

编译安装

make -j 4 && make install

  

上面的步骤有可能出现的问题:

1、configure: WARNING: unrecognized options: --with-mcrypt, --with-libmbfl, --enable-gd-native-ttf

说明上面的配置参数已经弃用了,删除即可。

2、configure: error: DBA: Could not find necessary header file(s).

安装下 yum install gdbm-devel

3、configure: error: Cannot find ldap libraries in /usr/lib

拷贝下文件 cp -frp /usr/lib64/libldap* /usr/lib/

4、configure: error: off_t undefined; check your library configuration

进行如下操作:

vi /etc/ld.so.conf
# 添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
# 保存退出
:wq
# 使之生效
ldconfig -v

5、configure: error: Please reinstall the libzip distribution

在 https://libzip.org/download/ 下载源码,进行安装

tar xf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build && cd build && cmake .. && make && make install

6、CMake 3.0.2 or higher is required. You are running version 2.8.12.2

说明你的cmake版本过低,需要重新安装

先删除原有cmake

yum remove cmake

在 https://cmake.org/download/ 下载源码

tar xf cmake-3.14.3.tar.gz
cd cmake-3.14.3
./bootstrap && make && make install

然后修改 vi /etc/profile,并加入如下内容

PATH=/usr/local/bin:$PATH
export PATH
source /etc/profile

  

六、配置php.ini文件

具体的路径,大家可自行修改。

cp php.ini-development /data/nmp/php/etc/php.ini
cp /data/nmp/php/etc/php-fpm.conf.default /data/nmp/php/etc/php-fpm.conf
cp /data/nmp/php/etc/php-fpm.d/www.conf.default /data/nmp/php/etc/php-fpm.d/www.conf

配置php.ini文件

max_execution_time = 120
max_input_time = 120
memory_limit = 1024M
post_max_size = 128M
date.timezone = PRC
extension_dir = "/data/nmp/php/lib/php/extensions/no-debug-zts-20180731"

  

七、配置Systemd服务

其实php-fpm.service文件php已经帮我们配置好了,只需要我们复制到指定位置,并启用就行了。

cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/

php-fpm.service文件内容如下:

[Unit]
Description=The PHP FastCGI Process Manager
After=network.target [Service]
Type=simple
PIDFile=/data/nmp/php/var/run/php-fpm.pid
ExecStart=/data/nmp/php/sbin/php-fpm --nodaemonize --fpm-config /data/nmp/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true [Install]
WantedBy=multi-user.target

启用php-fpm.service

systemctl enable php-fpm.service

启动php-fpm

systemctl start php-fpm.service

  

centos7下编译安装php7.3的更多相关文章

  1. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  2. centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展

    centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...

  3. Linux Centos7.2 编译安装PHP7.0.2

    操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...

  4. CentOS7下编译安装redis-5.0.9

    CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...

  5. 【安装PHP】如何在openSUSE42.1下编译安装PHP7

    首先推荐一篇文章PHP 7 Release Date Arrived: Will Developers Adopt PHP 7? - PHP Classes blog. 里面说到是否会去使用PHP7, ...

  6. centos7.5环境下编译安装php7.0.30并安装redis和mongo扩展

    .安装php7..30的脚本 # vim install_php.sh #!/bin/bash # 安装基本依赖 yum install -y gcc gcc-c++ htop telnet ioto ...

  7. Centos7.2 编译安装PHP7

    PHP7,编译安装: 环境:centos7.2    (注意:因为我用的nginx, 此配置参数没有考虑到apache,所以不合适需要用apache的朋友照搬过去运行,但是可以参考.)   直接下载P ...

  8. CentOS 7.2mini版本下编译安装php7.0.10+MySQL5.7.14+Nginx1.10

    一.安装前的准备工作 1.yum update    #更新系统 2.yum install gcc gcc-c++ autoconf automake cmake bison m4 libxml2  ...

  9. CentOS 7.2mini版本下编译安装php7.0.10+MySQL5.7.14+Nginx1.10.1

    一.安装前的准备工作 1.yum update    #更新系统 1.1)vi /etc/selinux/config #  禁止SELINUX,设置SELINUX=disabled 2.yum in ...

随机推荐

  1. The usage of docker image wurstmeister/kafka

    The docker image wurstmeister/kafka is the most stared image for kafka in hub.docker.com, but the us ...

  2. asp微信支付代码证书文件post_url.aspx和post_url.aspx.cs源码下载

    很多朋友在网上找的asp支付代码中都没有这两个证书文件,只能是用别人的,但是如果别人把他的网站这个文件删了,你的支付也就不能用了,今天我就把大家需要的这两个asp微信支付代码证书文件post_url. ...

  3. jmeter多sql查询

    背景:实现多条sql语句,取多个值的情况 步骤:1.JDBC Connection Configuration配置添加?allowMultiQueries=true 2.增加sql语句 ,查询或修改语 ...

  4. python 模拟百度搜索

    import urllib.request def Url(url): flag = input("请输入要搜索的关键字:") headers_ = { "User-Ag ...

  5. H3路由器映射端口到外网

    登录华三路由器 依次点击菜单 “防火墙”-->“NAT”-->“内部服务器”  将看到一个内部服务器转换的列表页面 点击列表页面的的新建然后完善页面提交即可 如下操作:

  6. Mysql 5 忘记root密码,设置免密登陆

    1.修改my.cnf配置文件 vi /etc/my.cnf #允许免密认证登陆 skip-grant-tables = true 2.重启Mysql数据库并登陆数据库修改root用户密码 system ...

  7. 重写 final关键字 多态调用子类特有的属性及行为(向上向下转型)

    1.override 重写:在继承中,子类与父类方法名相同,参数列表相同,的方法叫重写,与返回值有关;  主要应用于系统升级. 2.final 关键字: 可修饰:1.类-->被修饰后该类不能被继 ...

  8. laravel5.6中Session store not set on request问题如何解决

    先找到文件app下的Kernel.php文件,在文件中加入下列代码 protected $middleware = [ \Illuminate\Foundation\Http\Middleware\C ...

  9. window Linux 双系统安装

    我是先安装的win10,然后在其基础上又安装了Ubuntu 16.04,为了今后再次安装方便,这里记录一下安装过程. 我在安装时主要参考了文章:https://blog.csdn.net/flyyuf ...

  10. Redis 4.0.2.3 for Windows (alpha) 下载地址

    下载地址如下: https://github.com/tporadowski/redis/releases 如果直接使用redis-server.exe启动报错的话,就使用redis-server.e ...