源码编译PHP8.2.0及phpMyAdmin部署

php,php-fpm,phpMyadmin

Posted by Derrick on July 11, 2022

源码编译PHP8.2.0及phpMyAdmin部署



源码编译php

nginx,mysql安装省略

# 下载php8.2.0版本
# wget https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.gz --no-check-certificate

# 解压安装包
# tar -xvf php-8.2.0alpha1.tar.gz 

# 编译安装(-j 4 用4核cpu)
# './configure'  '--prefix=/usr/local/php82' '--with-config-file-path=/usr/local/php82/etc' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-zip' '--enable-mysqlnd'    '--with-mysql' '--with-pdo-mysql' '--enable-sockets' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--with-gd'

# make && make install -j 4



拷贝配置文件

# cp php-8.2.0alpha1/php.ini-production /usr/local/php8/php.ini

# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf

# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf

# 拷贝php,php-fpm快捷方式
# cp /usr/local/php8/bin/php /usr/local/sbin/
# cp php-8.2.0alpha1/sapi/fpm/php-fpm /usr/local/sbin/

# 拷贝php-fpm启动文件
# cp php-8.2.0alpha1/sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service



查看php,php-fpm版本并启动php-fpm

# 查看php,php-fpm版本
# php -v
# php-fpm -v

# 启动php-fpm
# systemctl daemon-reload 
# systemctl start php-fpm.service



部署phpMyAdmin5.2.0

# 下载phpMyadmin
# wget https://files.phpmyadmin.net/phpMyAdmin/4.9.10/phpMyAdmin-4.9.10-all-languages.zip --no-check-certificate

# 解压
# unzip phpMyAdmin-4.9.10-all-languages.zip

# 将phpMyAdmin-4.9.10-all-languages移动到nginx的html目录下
# mv phpMyAdmin-4.9.10-all-languages /usr/local/nginx/html/phpMyAdmin

# 修改phpMyAdmin配置文件
# cp config.sample.inc.php config.inc.php 



遇到的问题

phpMyadmin登陆后会报一大堆错误

升级php,php-fpm版本5.2——>8.2.0,升级phpMyadmin版本4.9——>5.2

# 在config.inc.php配置中添加,隐藏报错(不建议这么做)
# $cfg['SendErrorReports'] = 'never';


报错OK (rejected)和error(rejected)

点击homepage会报错OK (rejected),点击数据表,再点击SQL会报错error(rejected);原因是检查版本不兼容

# 关闭版本检查
# $cfg['VersionCheck'] = false;

ERROR: failed to open error_log (/usr/local/var/log/php-fpm.log): Read-only file system (30)

打开 /usr/lib/systemd/system/php-fpm.service 把
ProtectSystem=true
改成
ProtectSystem=false