编译安装PHP7.4
1、下载PHP源码包
wget https://www.php.net/distributions/php-7.4.30.tar.gz
2、解压缩
tar xf php-7.4.30.tar.gz -C /usr/local/src
3、预编译、检查环境
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli --with-pdo-mysql --with-mysql-sock=/usr/local/mysql/mysql.sock --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-curl --with-gd --with-gmp --with-zlib --with-xmlrpc --with-openssl --without-pear --with-snmp --with-gettext --with-mhash --with-libxml-dir=/usr --with-ldap --with-ldap-sasl --with-fpm-user=nginx --with-fpm-group=nginx --enable-xml --enable-fpm --enable-ftp --enable-bcmath --enable-soap --enable-shmop --enable-sysvsem --enable-sockets --enable-inline-optimization --enable-maintainer-zts --enable-mbregex --enable-mbstring --enable-pcntl --enable-zip --disable-fileinfo --disable-rpath --enable-libxml --enable-opcache --enable-mysqlnd
出现的错误
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:
解决方法:
yum install libxml2-devel -y
configure: error: Package requirements (openssl >= 1.0.1) were not met:
解决方法:
yum install openssl-devel -y
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
解决方法:
yum install sqlite-devel -y
configure: error: Package requirements (libcurl >= 7.15.5) were not met:
解决方法:
yum install libcurl-devel -y
configure: error: GNU MP Library version 4.2 or greater required.
解决方法:
yum -y install gmp-devel -y
configure: error: Cannot find ldap.h
解决方法:
yum install openldap openldap-devel -y
configure: error: Cannot find ldap libraries in /usr/lib.
解决方法:
cp -frp /usr/lib64/libldap* /usr/lib/
configure: error: Package requirements (oniguruma) were not met:
解决方法:
yum install oniguruma-devel -y
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
解决方法:
yum install net-snmp-devel -y
4、编译并安装
make & make install
出现的错误
cc: fatal error: Killed signal terminated program cc1
compilation terminated.
解决方法:
mkdir -p /var/cache/swap/
dd if=/dev/zero of=/var/cache/swap/swap0 bs=10M count=400
chmod 0600 /var/cache/swap/swap0
mkswap /var/cache/swap/swap0
swapon /var/cache/swap/swap0
swapon -s
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_strdup'
//usr/lib64/liblber-2.4.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:287: sapi/cli/php] Error 1
解决方法:
vim Makefile
#在以EXTRA_LIBS开头的一行结尾添加‘-llber’,如下:
EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lldap -lgmp -lrt -lm -ldl -lpthread -lxml2 -lssl -lcrypto -lsqlite3 -lz -lcurl -lxml2 -lssl -lcrypto -lonig -lsqlite3 -lxml2 -lnetsnmp -lm -lssl -lssl -lcrypto -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lxml2 -lz -lssl -lcrypto -lcrypt -llber
5、配置php配置文件
#移动php配置文件的位置,并修改名称
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.conf
#复制php.ini文件
cp /usr/local/src/php-7.4.30/php.ini-production /usr/local/php/etc/php.ini
6、复制php启动脚本到/etc/init.d/
cp /usr/local/src/php-7.4.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
systemctl enable php-fpm.service
/usr/lib/systemd/systemd-sysv-install enable php-fpm
systemctl status php-fpm.service
编译安装PHP7.4的更多相关文章
- 编译安装PHP7并安装Redis扩展Swoole扩展
编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机器上已经有编译安装过php5.3以上的版本,从而依赖库都有了 本php7是编译成fpm-php 使用的, 如果是apache那么 ...
- 【安装PHP】如何在openSUSE42.1下编译安装PHP7
首先推荐一篇文章PHP 7 Release Date Arrived: Will Developers Adopt PHP 7? - PHP Classes blog. 里面说到是否会去使用PHP7, ...
- 全志a20安卓电视盒子安装可道云kodexplorer服务-编译安装php7.3+nginx
可道云真的很强大,安装包很小,功能却很齐全,还可以自定义轻应用如果有手机客户端就更好了 研究了一下,可道云根目录放到外置存储设备(移动硬盘)会更合适,改路径的方法下面有提到上传文件时一个文件会在用户目 ...
- 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 ...
- 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 二.安装所需依 ...
- 编译安装PHP7并安装Redis扩展Swoole扩展(未实验)
用PECL自动安装Redis扩展.Swoole扩展 pecl install redis pecl install swool 编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机 ...
- CentOS编译安装php7.2
介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是否存在兼容性,如果程序是基于php ...
- CentOS7 编译安装 php7
更新:2019-01-25 补充:CentOS 7.5 全新编译安装 PHP-7.3.1 ,补充内容接在原文之后 更新:2018-09-29 补充:新系统下编译安装PHP-7.2.5遇到的问题,补充内 ...
- Linux Centos7.2 编译安装PHP7.0.2
操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...
- Centos7源码编译安装PHP7.2(生产环境)
安装PHP依赖包,否则在编译的过程中可能会出现各种报错 # Centos 安装epel-release源并将系统包更新到最新版本 $ yum install epel-release-y $ yum ...
随机推荐
- java-RandomAccessFile操作以及IO流简单使用
1.1RandomAccessFile--使用RAF读写基本类型数据,以及了解Raf的指针操作 write有相对应的写入基本类型的方法 void seek(Long pos)调整RAF指针位置,可以在 ...
- 将 Word 文本转换为表格
文本转换为表格的功能,首先点击"插入"选项卡"表格"组中的"表格"下拉按钮,打开下拉列表中选择"文本转换成表格"选项.
- 从C过渡到C++——换一个视角深入数组[初始化](1)
从C过渡到C++--换一个视角深入数组[初始化](1) 目录 从C过渡到C++--换一个视角深入数组[初始化](1) 数组的初始化 从C入手 作用域 代码块作用域 文件作用域 原型作用域 函数作用域 ...
- ettercap之dns欺骗攻击
前言:攻击机(kali)和受害机(win7)需在同一网段下 1.首先创建一个钓鱼克隆网站,这里我就利用CS来弄了 2.对Ettercap的dns文件进行编辑 3.开启ettercap 4.去受害机看看 ...
- Spring 源码学习笔记10——Spring AOP
Spring 源码学习笔记10--Spring AOP 参考书籍<Spring技术内幕>Spring AOP的实现章节 书有点老,但是里面一些概念还是总结比较到位 源码基于Spring-a ...
- Docker0网络及原理探究
个人观点:Docker网络通信在容器编排.集群部署中具有举足轻重的地位,(玩docker不懂docker0那就......玩不透哇)本篇分析Docker网络,并通过启动几个容器来探究Docker网络及 ...
- Python自学教程12-类和对象怎么用
Python是一门现代化的编程语言,也是一门面向对象的编程语言. 现代编程语言几乎都支持面向对象编程,面向对象编程是最有效的软件编写方法之一.你可以用类和对象来表示现实当中的任何的事物和行为. 编写类 ...
- K8S之YAML配置文件
通过 YAML 配置文件 部署 Deployment 使用命令(类似 docker-compose) // 部署 kubectl create -f xxx.yml // 删除 kubectl del ...
- 回溯剪枝,dfs,bfs
dfs: 给定一个整数n,将数字1~n排成一排,将会有很多种排列方法. 现在,请你按照字典序将所有的排列方法输出. 输入格式 共一行,包含一个整数n. 输出格式 按字典序输出所有排列方案,每个方案占一 ...
- HTTP和Servlet快速入门
目录 1.HTTP 1.1 请求数据格式 1.2 相应数据格式 2.Servlet 3.Servlert的xml配置 1.HTTP 1.1 请求数据格式 请求行:请求数据的第一行 包含三个内容,按顺序 ...