phpMyAdmin无法读取config.inc.php配置文件问题求助
phpMyAdmin无法读取config.inc.php文件排查求助
核心问题:phpMyAdmin无法找到或读取config.inc.php文件。为测试程序是否读取该文件,我故意在文件中加入错误代码(添加文本this should produce an error以及echo $blah->blah->blah),但phpMyAdmin仍能正常运行(仅需手动输入账号密码,无法使用配置文件预设的内容)。httpd日志与php-fpm日志中均无报错信息。
已尝试将config.inc.php放置在以下目录:
- /etc/phpMyAdmin
- /usr/share/phpMyAdmin
- /var/lib/phpMyAdmin/
- /var/lib/phpMyAdmin/config
- 本地include路径目录
此前多次安装phpMyAdmin,它通常会读取/etc/phpMyAdmin下的配置,从未遇到此问题。上述所有目录我都为apache用户与www组设置了从phpMyAdmin目录向下的读写权限(Apache与php-fpm均以此身份运行)。
服务器环境:全新虚拟机,运行CentOS9、Remi仓库的PHP 8.2.8与MariaDB 10.5,phpMyAdmin通过dnf包管理器安装。
补充信息
PHP错误日志配置
; https://php.net/error-reporting error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but ; it could be very dangerous in production environments. Depending on the code ; which is triggering the error, sensitive information could potentially leak ; out of your application such as database usernames and passwords or worse. ; For production environments, we recommend logging errors rather than ; sending them to STDOUT. ; Possible Values: ; Off = Do not display any errors ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) ; On or stdout = Display errors to STDOUT ; Default Value: On ; Development Value: On ; Production Value: Off ; https://php.net/display-errors display_errors = On ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. We strongly recommend you set this to 'off' ; for production servers to avoid leaking configuration details. ; Default Value: On ; Development Value: On ; Production Value: Off ; https://php.net/display-startup-errors display_startup_errors = Off ; Besides displaying errors, PHP can also log errors to locations such as a ; server-specific log, STDERR, or a location specified by the error_log ; directive found below. While errors should not be displayed on productions ; servers they should still be monitored and logging is a great way to do that. ; Default Value: Off ; Development Value: On ; Production Value: On ; https://php.net/log-errors log_errors = On
测试用config.inc.php前几行内容
<?php this should produce an error echo $blah->blah->blah /** * phpMyAdmin sample configuration, you can use it as base for * manual configuration. For easier setup you can use setup/ * * All directives are explained in documentation in the doc/ folder * or at <https://docs.phpmyadmin.net/>. */
日志检查结果
[root@mps httpd]# more xxxxxxxxxx.xx-error_log [root@mps httpd]# [root@mps ~]# cat /etc/php-fpm.d/xxxxxxxxxx.conf | grep error_log php_admin_value[error_log] = /var/log/php-fpm/php-fpm_xxxxxxxxxx.xx-error.log [root@mps ~]# more /var/log/php-fpm/php-fpm_xxxxxxxxxx.xx-error.log more: cannot open /var/log/php-fpm/php-fpm_xxxxxxxxxx.xx-error.log: No such file or directory [root@mps ~]#
内容的提问来源于stack exchange,提问作者John
相关产品推荐
相关产品推荐

