网站首页 > 精选文章 正文
一 PHP基础
1.1 服务器配置
4核CPU、8G内存100G磁盘空间,操作系统:CentOS7.8
1.2 下载地址
https://www.php.net/downloads.php
二 PHP安装
2.1 下载安装包到指定路径
cd /web
wget https://www.php.net/distributions/php-8.1.6.tar.gz
2.2 解压缩安装包
tar xf php-8.1.6.tar.gz
2.3 安装依赖
yum install libxml2-devel sqlite-devel bzip2-devel libcurl-devel libpng-devel libjpeg-devel freetype-devel libicu-devel libxslt-devel ibzip-devel dnf oniguruma-devel -y
2.4 编译
cd php-8.1.6
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --enable-fpm --enable-pdo --enable-bcmath --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --with-xmlrpc --with-ldap --enable-sysvsem --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-mysqlnd
报错1:
yum install openldap openldap-devel -y
重新编译
报错2:
原因:mbstring的正则功能需要oniguruma的支持,系统中却没有oniguruma库
解决:使用源码安装oniguruma库。
cd /web
wget https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/onig-6.9.5-rev1.tar.gz -O onig-6.9.5.tar.gz
tar xf onig-6.9.5.tar.gz
cd onig-6.9.5
./configure --prefix=/usr --libdir=/lib64
make && make install
再次重新编译
cd /web/php-8.1.6
报错3:
解决方案:
yum remove libzip-devel libzip
cd /web
wget https://libzip.org/download/libzip-1.3.2.tar.gz --no-check-certificate
tar xf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make && make install
echo 'export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"' >>/etc/profile
source /etc/profile
再次重新编译php
cd /web/php-8.1.6
编译完成
2.5 安装
make && make install
此步骤时间较长,我这边在安装的时候用时35分钟左右,需要耐心等待...
2.6 生成php.ini配置文件
cp php.ini-production /usr/local/php/etc/php.ini
2.7 生成www配置文件
cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf
2.8 生成php-fpm配置文件
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
2.9 生成php-fpm可执行文件
mkdir /usr/local/php/fpm
cp /web/php-8.1.6/sapi/fpm/init.d.php-fpm /usr/local/php/fpm/php-fpm
2.10 配置环境变量
echo 'export PATH=$PATH:/usr/local/php/bin:/usr/local/php/sbin' >>/etc/profile
source /etc/profile
2.11 查看版本
php --version
2.12 查看安装的扩展
php -m
2.13 启动php服务
php-fpm start
2.14 查看服务状态
ps -ef|grep php
至此,PHP安装完成,感谢观看,如果对您有帮助,请动动小手点点关注,点点赞,一起努力加油吧。
- 上一篇: Redis集群监控方法
- 下一篇: Windows安装phpstudy
猜你喜欢
- 2025-01-17 php进阶到架构之swoole系列教程(一)windows安装swoole
- 2025-01-17 如何通过phpstudy在Windows上搭建PHP开发环境
- 2025-01-17 Windows server 2003服务器搭建PHP环境
- 2025-01-17 中文/日文 PHP CGI 安装包 9.8 分漏洞遭黑客滥用,已修复
- 2025-01-17 ??2024年1月PHP版本使用分析
- 2025-01-17 黑客学习搭建社工库nas黑群晖部署安装apache+php+mysql个人网站
- 2025-01-17 最新版本PHP7.0.0正式发布,能发挥PHP5.6的2倍性能
- 2025-01-17 从零开始学习PHP
- 2025-01-17 在Windows环境使用PHP7.0
- 2025-01-17 php开发者composer使用看这一篇就够了
- 最近发表
- 标签列表
-
- 向日葵无法连接服务器 (32)
- git.exe (33)
- vscode更新 (34)
- dev c (33)
- git ignore命令 (32)
- gitlab提交代码步骤 (37)
- java update (36)
- vue debug (34)
- vue blur (32)
- vscode导入vue项目 (33)
- vue chart (32)
- vue cms (32)
- 大雅数据库 (34)
- 技术迭代 (37)
- 同一局域网 (33)
- github拒绝连接 (33)
- vscode php插件 (32)
- vue注释快捷键 (32)
- linux ssr (33)
- 微端服务器 (35)
- 导航猫 (32)
- 获取当前时间年月日 (33)
- stp软件 (33)
- http下载文件 (33)
- linux bt下载 (33)