Arch Linux安装phpMyAdmin遇版本错误及空白页问题求助
问题描述
- 访问
localhost/phpmyadmin时,页面显示PHP版本检测相关的代码片段:PHP 7.2.5+ is required.
Currently installed version is: ' . PHP_VERSION . '
'); } // phpcs:disable PSR1.Files.SideEffects define('PHPMYADMIN', true); // phpcs:enable require_once ROOT_PATH . 'libraries/constants.php'; /** * Activate autoloader */ if (! @is_readable(AUTOLOAD_FILE)) { die( 'File ' . AUTOLOAD_FILE . ' missing or not readable.
' . 'Most likely you did not run Composer to ' . '' . 'install library files.
' ); } require AUTOLOAD_FILE; global $route, $containerBuilder, $request; Common::run(); $dispatcher = Routing::getDispatcher(); Routing::callControllerForRoute($request, $route, $dispatcher, $containerBuilder); - 本地已安装PHP版本为:
PHP 8.1.8 (cli) (built: Jul 9 2022 06:10:37) (NTS) - 已按照Arch官方文档完成所有步骤,但访问URL时仍出现空白页,重置配置后问题依旧。
解决方案
验证Web服务器使用的PHP版本:
在Web根目录创建phpinfo.php文件,内容如下:<?php phpinfo(); ?>访问
localhost/phpinfo.php查看PHP版本,确认与CLI版本一致。Web服务器的PHP模块版本可能和CLI版本存在差异,这会导致版本检测错误。确认phpMyAdmin依赖完整性:
如果是手动下载安装的phpMyAdmin,需进入其安装目录执行composer install以安装依赖库;若通过Arch官方包管理器安装,确保包已完整安装,可重新执行sudo pacman -S phpmyadmin修复。检查Web服务器的PHP配置:
- 若使用Apache,确保
mod_php或php-fpm模块已启用,配置文件中已正确关联PHP处理规则; - 若使用Nginx,确认配置文件中已正确设置
fastcgi_pass指向PHP-FPM的套接字(通常为unix:/run/php-fpm/php-fpm.sock),并配置了PHP文件的处理规则。
- 若使用Apache,确保
查看错误日志定位问题:
查看Web服务器错误日志(如Apache的/var/log/httpd/error_log、Nginx的/var/log/nginx/error.log)和PHP错误日志,日志中会包含具体的错误信息,帮助精准排查问题。
内容的提问来源于stack exchange,提问作者slinger

