当前位置:网站首页>银河麒麟V10 SP2 x86编译安装 PHP7.4
银河麒麟V10 SP2 x86编译安装 PHP7.4
2022-07-29 20:43:00 【人间小苦瓜_】
目录
前言
PHP不断发展,他们刚刚发布了最新PHP 7.4更新。 正如我们在过去PHP 7版本中所证明的那样,性能和速度在不断提高。 预加载是最令人激动的新更新之一。 由于简化了常见的代码行,因此可以加快脚本执行速度,并使代码更清洁,更快。
一、PHP是什么?
PHP是www上的重要元素,并且在超过79%的网站中使用。 诸如Facebook,Wikipedia,WordPress等知名网站都在使用PHP。 当查看运行PHP的WordPress网站并比较PHP 5和7时,我们可以看到速度提高了两倍。在使用最新PHP版本的情况下– WordPress驱动的网站获得了最大的收益。
二、使用步骤
1.下载安装包
wget https://www.php.net/distributions/php-7.4.16.tar.gz
2.准备PHP相关依赖包
2.1安装oniguruma-6.9.4
[[email protected] mysqlpackage]# wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
[[email protected] mysqlpackage]# tar -xvf oniguruma-6.9.4.tar.gz
[[email protected] mysqlpackage]# cd oniguruma-6.9.4/
[[email protected] mysqlpackage]#./autogen.sh && ./configure --prefix=/usr --libdir=/lib64
[[email protected] mysqlpackage]# make && make install
2.2.安装libmcrypt
[[email protected] mysqlpackage]# wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
#安装libmcrypt
[[email protected] mysqlpackage]# tar xf libmcrypt-2.5.8.tar.gz
[[email protected] mysqlpackage]# cd libmcrypt-2.5.8
[[email protected] mysqlpackage]# ./configure --prefix=/usr/local/libmcrypt
[[email protected] mysqlpackage]# make && make install
2.3.安装依赖环境
[[email protected] mysqlpackage]# yum -y install libtool sqlite-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel readline readline-devel libxslt libxslt-devel
2.4 开始编译PHP
[[email protected] tools]# tar -xvf php-7.4.16.tar.gz
[[email protected] tools]# cd php-7.4.16
#编辑PHP的配置项
./configure --prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx \
--enable-inline-optimization --disable-debug --disable-rpath \
--enable-shared --enable-soap --with-xmlrpc \
--with-openssl --with-mhash --with-sqlite3 \
--with-zlib --enable-bcmath --with-iconv --with-bz2 \
--enable-calendar --with-curl --with-cdb --enable-dom \
--enable-exif --enable-fileinfo --enable-filter \
--enable-ftp --with-openssl-dir --with-zlib-dir \
--enable-gd-jis-conv --with-gettext --with-gmp --with-mhash \
--enable-json --enable-mbstring --enable-mbregex \
--enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--with-zlib-dir --with-pdo-sqlite --with-readline --enable-session \
--enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg \
--enable-sysvsem --enable-sysvshm --with-xsl \
--enable-mysqlnd-compression-support --with-pear \
--enable-opcache --disable-fileinfo
#安装
[[email protected] tools]# make -j 3 && make install
3.修改配置添加快捷启动
#添加环境变量
echo "export PATH=$PATH:/usr/local/php/bin" >> /etc/profile
source /etc/profile
#准备配置文件
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
ln -s /usr/local/php/etc/ /etc/php
#修改 /usr/local/php/etc/php-fpm.conf 运行用户和组改为nginx
chown nginx.nginx /usr/local/php/etc/php-fpm.conf
chown -R nginx.nginx /etc/php
#禁用PHP功能
sed -i "s#disable_functions =#disable_functions =\"passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,wnam,posix_getpwuid, posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname\"#" /etc/php/php.ini
#支持mysql
sed -i "s#pdo_mysql.default_socket=#pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
#" /etc/php/php.ini
sed -i "s#mysqli.default_socket =#mysqli.default_socket =/var/lib/mysql/mysql.sock
#" /etc/php/php.ini
#设置开机自启,并启动
cp /opt/tools/php-7.4.16/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig php-fpm on
systemctl start php-fpm
总结
php依赖环境较为复杂,如果在编译过程中出现报错,可以根据提示,安装对应依赖即可
边栏推荐
- The younger brother asked: Is the work of a programmer a day’s work of code?
- UDP协议详解
- Bug fix: Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]
- Huawei laptop keyboard locked (how does the laptop keyboard light up)
- 如何进入董事会:给CIO的十条建议
- PyQt5学习一(环境搭建)
- 网站ping端口的操作方法和命令介绍
- 7 行代码搞崩溃 B 站,原因令人唏嘘!
- 7 行代码搞崩溃 B 站,原因令人唏嘘!
- :class数组写法
猜你喜欢
【无标题】
第二好PyTorch新手课程;论文写作指南;使用µGo语言开发迷你编译器;超高效使用Transformer的扩展库;前沿论文 | ShowMeAI资讯日报
OAuth,JWT ,OIDC你们搞得我好乱啊
PEG-PEI共聚物/DNA复合物|甘草次酸修饰的长循环阳离子脂质体DNA复合物|解析说明
如何进入董事会:给CIO的十条建议
解释器模式
336. 回文对
Second Best PyTorch Beginner Course; Thesis Writing Guide; Using µGo to Develop a Mini Compiler; Super Efficient Use of Transformer's Extension Library; Frontier Papers | ShowMeAI News Daily
相亲信息
一 JS中Promise用法、二闭包的概念与用法、三对象创建的四种方式与区区别、四 如何声明一个类
随机推荐
Oracle问题: ORA-01882: 未找到时区
Minimal jvm source code analysis
用 Array.every & Array.some 匹配全部/部分内容 es6
指定宽度截取字符串
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
模型推理模板
从专业角度分析国内创客教育发展
offsetwidth111[easy to understand]
[Database] mysql date format conversion
MySQL Data Query - Simple Query
Where is Naive Bayes "naive"?
Bug fix: Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]
Use the PostgreSQL GRANT command to modify permissions on various database objects
Baidu internship students late night fun: originally giant is this kind of life
OneNote 教程,如何在 OneNote 中做笔记?
First thoughts on the first attempt to avoid killing without a file (Part 1)
惠普服务器硬盘指示灯不亮或显示蓝色
系列(jupyter自动保存失败)
赶紧进来!!!带你认识C语言基本数据类型
关于论青少年尽早学少儿编程之说