在Google App Engine上运行Wordpress时出现数据库错误

时间:2013-10-02 07:47:35

标签: php mysql wordpress google-app-engine google-cloud-sql

我正在尝试在我的PHP运行时白名单Google App Engine应用程序上运行Wordpress。我创建了一个名为“wordpress”的模块,并按照this article中的说明安装了Wordpress 3.6.1(荷兰语)。 (更新:我尝试过Wordpress 2.5.1英语,2.6荷兰语和2.6.1荷兰语。我在所有版本中都收到了相同的错误消息。)

它在我的本地开发环境中没有问题,但在Google App Engine上没有生产。当我转到http://www.mydomain.com/wordpress/时,它会重定向到http://www.mydomain.com/wordpress/wp-admin/install.php。在Wordpress模块​​的App Engine日志中,我收到这些消息(“databasefout”表示“数据库错误”):

E 2013-10-02 09:23:33.030
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'siteurl' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), wp_plugin_directory_constants, get_option
...
E 2013-10-02 09:23:33.506
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'cron' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_next_scheduled, _get_cron_array, get_option
E 2013-10-02 09:23:33.511
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('cron', 'a:2:{i:1380698613;a:1:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, add_option
E 2013-10-02 09:23:33.513
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query UPDATE `wp_options` SET `option_value` = 'a:2:{i:1380698613;a:2:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}' WHERE `option_name` = 'cron' gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option
E 2013-10-02 09:23:33.515
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query UPDATE `wp_options` SET `option_value` = 'a:2:{i:1380698613;a:3:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}' WHERE `option_name` = 'cron' gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option
E 2013-10-02 09:23:33.516
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'theme_switched' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, check_theme_switched, get_option
E 2013-10-02 09:23:33.518
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1 gemaakt door require('wp-blog-header.php'), wp, WP->main, WP->parse_request, WP_Rewrite->wp_rewrite_rules, get_option
...
E 2013-10-02 09:23:33.530
WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'sticky_posts' LIMIT 1 gemaakt door require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, get_option

我的Google Cloud SQL实例上的我的数据库wordpress_db仍然是空的(没有表格)。我的MySQL用户具有以下权限:

GRANTEE
TABLE_CATALOG
TABLE_SCHEMA
PRIVILEGE_TYPE
IS_GRANTABLE
'wp_user'@'localhost'
def
wordpress_db
SELECT
NO
'wp_user'@'localhost'
def
wordpress_db
INSERT
NO
'wp_user'@'localhost'
def
wordpress_db
UPDATE
NO
'wp_user'@'localhost'
def
wordpress_db
DELETE
NO
'wp_user'@'localhost'
def
wordpress_db
CREATE
NO
'wp_user'@'localhost'
def
wordpress_db
DROP
NO
'wp_user'@'localhost'
def
wordpress_db
REFERENCES
NO
'wp_user'@'localhost'
def
wordpress_db
INDEX
NO
'wp_user'@'localhost'
def
wordpress_db
ALTER
NO
'wp_user'@'localhost'
def
wordpress_db
CREATE TEMPORARY TABLES
NO
'wp_user'@'localhost'
def
wordpress_db
LOCK TABLES
NO
'wp_user'@'localhost'
def
wordpress_db
EXECUTE
NO
'wp_user'@'localhost'
def
wordpress_db
CREATE VIEW
NO
'wp_user'@'localhost'
def
wordpress_db
SHOW VIEW
NO
'wp_user'@'localhost'
def
wordpress_db
CREATE ROUTINE
NO
'wp_user'@'localhost'
def
wordpress_db
ALTER ROUTINE
NO
'wp_user'@'localhost'
def
wordpress_db
EVENT
NO
'wp_user'@'localhost'
def
wordpress_db
TRIGGER
NO

可能是什么问题?在我看来,Wordpress在创建表之前尝试访问表wordpress_db.wp_options

更新:如果我在Google Cloud SQL实例上手动创建数据库表,然后转到http://www.mydomain.com/wordpress/,我会收到消息:

  

wordpress错误建立数据库连接

2 个答案:

答案 0 :(得分:1)

我有同样的问题,我的网站在localhost上工作正常但在服务器上没有。

当我深入研究我的代码时,我发现有一些代码丢失了 CREATE [TEMPORARY] TABLE [IF NOT EXISTS] "tbl_name

用于创建db的wordpress文件中的

,不记得它是如何被称为

问候

答案 1 :(得分:1)

如果您通过URL wordpress-dot-myapp.appspot.com访问Wordpress,安装只会成功。如果您通过www.mydomain.com/wordpress访问它,则安装不会成功。请注意,就我而言,Wordpress是作为现有Python应用程序的module安装的。