简体   繁体   English

相同的 PHP,相同的服务器,不同的结果

[英]Same PHP, Same Server, Different Results

I have three domains on the same server (CentOS 7.5.1804), all running WordPress 4.9.8, all running the same version of PHP (7.2.10) and using the same php.ini file (literally, not the same php.ini file copied to each directory, the exact same single file).我在同一台服务器 (CentOS 7.5.1804) 上有三个域,都运行 WordPress 4.9.8,都运行相同版本的 PHP (7.2.10) 并使用相同的 php.ini 文件(字面上,不是相同的 php.ini 文件)。 ini 文件复制到每个目录,完全相同的单个文件)。

The problem is that on only one domain, WordPress thinks that I don't have php-mysql installed, yet the other two sites work without issue.问题是,只有在一个域上,WordPress 认为我没有安装php-mysql ,但其他两个站点却没有问题。

I get the following on the non-working domain:我在非工作域上得到以下信息:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.您的 PHP 安装似乎缺少 WordPress 所需的 MySQL 扩展。

Despite the fact that the same php.ini file is being used, on the non-working site, the phpinfo() report is missing the mysqli section.尽管正在使用相同的php.ini文件,但在非工作站点上, phpinfo()报告缺少mysqli部分。

Domains are: hummdis.com (non-working), dev.hummdis.com (working), exoticallyplugged.com (working).域是: hummdis.com (非工作), dev.hummdis.com (工作), exoticallyplugged.com (工作)。

Thoughts??想法??

The only explanation I can conceive is that all tests for MySQL fail , and they do so in all your sites .我能想到的唯一解释是MySQL 的所有测试都失败了,而且它们在您的所有站点中都失败了

But on the two working sites, you have a db.php fixup file that makes things right.但是在两个工作站点上,您有一个db.php修复文件,可以使事情正确。 On the one that doesn't work, the WP_CONTENT_DIR has no fixup.在一个不起作用的情况下, WP_CONTENT_DIR 没有修复。

This is the relevant source section :这是相关的源代码部分

if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' )
    && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
    wp_load_translations_early();
    $protocol = wp_get_server_protocol();
    header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
    header( 'Content-Type: text/html; charset=utf-8' );
    die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );

As you can see, the error is only generated if all the tests fail, and there is no "db.php" to be found.如您所见,只有在所有测试都失败时才会生成错误,并且没有找到“db.php”。

You may also want to check whether the .htaccess directives are the same between the sites.您可能还想检查站点之间的.htaccess指令是否相同。 I seem to remember that MySQL modules may be loaded dynamically, and if so, it could be that some sites load them, and some don't .我似乎记得 MySQL 模块可能是动态加载的,如果是这样,可能是某些站点加载了它们,而有些则没有

So, I've resolved the issue and I'm not 100% sure what fixed it.所以,我已经解决了这个问题,但我不是 100% 确定是什么解决了它。 However, these are the steps that I took:但是,这些是我采取的步骤:

  1. yum update
  2. This resulted in:这导致:

Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:发现 3 个预先存在的 rpmdb 问题,'yum check' 输出如下:

I'm not going to provide the full update, the point is that I couldn't perform a Yum update because of these issues.我不打算提供完整的更新,重点是由于这些问题我无法执行 Yum 更新。

  1. I found this post and followed the steps.我找到了这篇文章并按照步骤操作。
  2. I then found this post and followed the steps that install yum plugin-priorities .然后我找到了这篇文章并按照安装yum plugin-priorities的步骤进行了操作。

I then tested the site and it's loading without issue.然后我测试了该网站,它的加载没有问题。

Maybe missing from $PATH the locations, some info.也许 $PATH 中缺少位置,一些信息。 Go to commnad line of a working domain and issue: which php-mysql and issue the same commnad to the one that is not working.转到工作域的 commnad 行并发出:which php-mysql 并将相同的 commnad 发送到不起作用的那个。

It looks, if you use diffent linux user, in .profile to have problem看起来,如果您使用不同的 linux 用户,在 .profile 中有问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM