【问题标题】:Having issues getting WordPress running under GAE + Cloud SQL在 GAE + Cloud SQL 下运行 WordPress 时遇到问题
【发布时间】:2016-10-20 04:18:15
【问题描述】:

我今晚早些时候尝试在 Google App Engine 下设置 WordPress(按照此处的说明操作:https://developers.google.com/appengine/articles/wordpress)。

它在本地运行良好,但是当我推送到远程时出现数据库错误(在https://wp-dot-frontiermediag.appspot.com/ 可见)。如果我们抛出 /wp_admin/install.php 你会得到:

This either means that the username and password information in your 
wp-config.php file is incorrect or we can't contact the database server 
at :/cloudsql/frontiermediag:fmwp. This could mean your host's database 
server is down.

这是 wp-config 中的相关代码:

/** MySQL hostname */
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
define('DB_HOST', ':/cloudsql/frontiermediag:fmwp');
}else{
  define('DB_HOST', 'localhost');
}

frontiermediag:fmwp 在 Developers Console > Cloud SQL 中显示“Status Runnable”。

我以前做过一次,它工作,所以我不确定我在这里错过了什么。我认为这可能是因为我使用的是 WP 3.8.1。但回滚到 3.5.1 并且发生了同样的事情。

有什么想法吗? frontiermediag 在 :fmwp ACL 上被列为授权应用程序。

【问题讨论】:

  • 您对 DB_USER 和 DB_PASSWORD 的设置是什么?它们是否与您的 CloudSQL 中的设置相匹配?

标签: google-app-engine google-cloud-sql


【解决方案1】:

这种情况发生在我之前。但是,我编辑了我的 Cloud SQL 实例,并在 Google Developers Console 中将“首选位置”设置为“关注 App Engine 应用程序”。在我的情况下,这个数据库连接问题得到了解决。

【讨论】:

    【解决方案2】:

    我尝试了 wordpress 3.5.1 的说明,这些说明似乎对我有用。您上面的代码 sn-p 似乎是正确的,如果不查看您的其余代码,我不确定会出现什么问题。你能在 3.5.1 中再尝试一次从头开始的说明吗?

    【讨论】:

      【解决方案3】:

      我遇到了这个问题,因为在我的情况下,“关注 App Engine 应用程序”似乎不是第二代实例的选项,因此实例连接名称包含区域设置。

      查看实例详细信息,然后在属性下找到“实例连接名称”。那是应该跟在:cloudsql/之后的文字。

      【讨论】:

        猜你喜欢
        • 2014-09-11
        • 1970-01-01
        • 2021-04-20
        • 1970-01-01
        • 2018-10-15
        • 2018-11-20
        • 1970-01-01
        • 1970-01-01
        • 2023-01-28
        相关资源
        最近更新 更多