服务器编译安装PHP7.4

1、安装基础组件,为后期安装准备

yum install autoconf cmake libxml2-devel openssl-devel sqlite-devel curl-devel libjpeg libjpeg-devel libpng-devel libzip-devel libwebp-devel gmp-devel dnf gcc libicu-dev gcc-c++ libtool autotools-dev automake m4 perl

dnf -y install freetype-devel

安装oniguruma

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz
tar -zxvf oniguruma-6.9.4.tar.gz
cd oniguruma-6.9.4/
#autoreconf -ivf
./autogen.sh  #./configure  --prefix=/usr --libdir=/lib64   #
make && make install
cd ../

安装libsodium

wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz
tar -zxf libsodium-1.0.18-stable.tar.gz
cd libsodium-stable
./configure 
make && make install
 
方法一:临时生效,重新登录即失效
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
方法二:永久生成
vim /etc/profile
在profile文件加上
export  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
然后执行
source /etc/profile

安装PHP

wget https://www.php.net/distributions/php-7.4.22.tar.gz
tar zxvf php-7.4.22.tar.gz 或本地 tar -jxvf php-7.4.22.tar.gz
cd php-7.4.15/
./buildconf --force

# gmp 使用 –with-gmp 不使用  –enable-gmp

./configure '--prefix=/data/server/php74' '--with-config-file-path=/data/server/php74/etc' '--enable-mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-iconv-dir' '--with-freetype' '--with-jpeg' '--with-zlib' '--enable-xml' '--enable-gmp'  '--enable-zip' '--disable-rpath' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--enable-intl' '--enable-ftp' '--enable-gd' '--with-openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-soap' '--with-gettext' '--enable-fileinfo' '--enable-opcache' '--with-sodium=/usr/local' '--with-webp'

make && make install

#mkdir /data/server/php74/etc

cp php.ini-development /data/server/php74/etc/php.ini

# 使用cgi 需要修改 php.ini 去掉下面的注释 1 改为 0

cgi.force_redirect = 0

安装cmake

wget https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1.tar.gz

tar -zxvf cmake-3.28.1.tar.gz

cd cmake-3.28.1

./bootstrap  or ./configure

make && make -install

4、安装 libzip

yum remove libzip -y

(1)、下载安装或直接使用本地包

wget https://nih.at/libzip/libzip-1.10.0.tar.gz 

tar -zxvf libzip-1.10.0.tar.gz

cd libzip-1.10.0

mkdir build

cd build

cmake ..

make && make install

5、安装 zip

(1)、下载安装或直接使用本地包

wget http://pecl.php.net/get/zip-1.21.1.tgz

tar zxfv zip-1.21.1.tgz

cd zip-1.21.1

/data/server/php74/bin/phpize #/usr/bin/phpize

# 出现:

Configuring for:

PHP Api Version:         20190902

Zend Module Api No:      20190902

Zend Extension Api No:   320190902 

./configure  --with-php-config=/data/server/php74/bin/php-config

#对应版本的php目录

#cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

make && make install

#使用 find / -name php.ini 查找配置文件地方

cd /data/server/php74/etc/

#在php.ini里写入

echo extension = zip.so >> php.ini

使用 php -m 检查zip扩展是否安装成功,如果不成功执行 ldconfig /usr/local/lib 和 ldconfig /usr/local/lib64 后,再次通过 php -m 查看

原创文章,作者:admin,如若转载,请注明出处:https://ntib.cn/193.html

(1)
adminadmin
上一篇 2023年11月18日 下午10:56
下一篇 2023年11月18日 下午10:58

相关推荐

  • nginx/apache 添加跨越请求

    公司网址怎么做现在有很多的网站、系统都使用前后端分离的方式进行开发,有时候使用的不是相同的域名,这样就会存在跨域的问题,我们需要配置nginx或apache 来允许跨域的请求 apache 开启…

    记事本 2023年11月18日
  • nginx 配置 php-fpm时出现502解决办法

    公司网址怎么做一直使用面板来配置服务器环境,只需简单几步就可以配置好自己想要的web环境了,偶尔也需要不使用面板来配置 nginx+PHP 环境,一顿操作后,发现访问网站时返回 An error…

    2024年11月9日
  • 解决windows+nginx下 PHP-CGI 进程崩溃问题

    公司网址怎么做本地开发系统使用的是windows系统下,配置的 nginx+php,在使用过程中总是出现崩溃现象,网上搜解决办法时,很多网友说是PHP-CGI 进程崩溃 造成的,当 php-cg…

    2023年11月18日
  • FreeSWITCH外呼主叫挂机后,被叫不挂机处理

    公司网址怎么做FreeSWITCH外呼时主叫挂机后,被叫不能自动挂断处理办法 修改 conf/sip_profiles/internal.xml 中的

    记事本 2024年2月20日
  • 让你的FastAdmin在PHP8下运行

    公司网址怎么做PHP8发布很长时间了,但FastAdmin还不能在PHP8下运行,官方文档环境要求 PHP >= 7.2 且 <= 7.4 (推荐PHP7.4版本),因为一些开源扩展…

    2023年11月18日
  • CentOS 相关安全设置

    公司网址怎么做1、centos 修改密码强度策略修改 /etc/pam.d/system-auth 在 password requisite pam_pwquality.so 中添加minlen…

    记事本 2023年12月13日
  • centos7调整根目录挂载分区容量大小

    公司网址怎么做由于系统初始时根目录一般空间为50左右 有时会被占满,而/home目录却有大量空间 这里需要调整: 1.终止占用 /home 进程 fuser -m -v -i -k /home​…

    记事本 2018年11月18日
  • ThinkPHP 数据迁移使用

    公司网址怎么做ThinkPHP数据库迁移工具可以将数据库结构和数据很容易的在不同的数据库之间管理迁移,使用起来也很方便。 执行后就会在项目根目录多一个database目录自动创建一个文件,就可以…

    2023年11月25日
  • 宝塔面板一键迁移网站及数据库

    公司网址怎么做两个服务器间迁移数据太麻烦了,宝塔面板中有宝塔一键迁移插件安装上,注意是在要迁出数据的服务器上安装,安装完成后,在一键迁移插件设置中输入 新服务器的面板地址及面板API密钥。按照提…

    2023年11月18日
  • wordpress 广告敏感词违禁词替换插件

    公司网址怎么做在百度站长工具中看网站的流量,发现有很多搜索词都是违禁广告词,一直没注意这种问题,查了一下相关的法律。 广告法违禁词处罚规定根据广告法,极限用语不得出现在商品列表页、商品的标题、副…

    2023年11月18日

发表回复

登录后才能评论
WeChat