php - 无法启动 Google Cloud phpMyAdmin 页面?

标签 php mysql google-app-engine phpmyadmin

我正在尝试使用以下链接为 Google Cloud 设置 phpMyAdmin 页面,我在此网站上 100% 关注该链接:https://cloud.google.com/sql/docs/phpmyadmin-on-app-engine当我尝试运行 php 服务器以查看它是否已启动并运行时,我执行以下操作:

C02Q202LG8WL:phpMyAdmin user$ appcfg.py update .
01:26 AM Application: database-140707; version: 2
01:26 AM Host: appengine.google.com
01:26 AM Starting update of app: database-140707, module: phpmyadmindb, version: 2
01:26 AM Getting current resource limits.
01:26 AM Scanning files on local disk.
01:26 AM Scanned 500 files.
01:26 AM Scanned 1000 files.
01:26 AM Scanned 1500 files.
01:26 AM Scanned 2000 files.
01:26 AM Cloning 1113 static files.
01:27 AM Rolling back the update.
Error 409: --- begin server output ---
No transaction is in progress.
--- end server output ---

我们不断收到此没有交易正在进行中。错误。它阻止我加载 localhost/phpmyadmin 页面。有什么想法为什么会发生这种情况吗?如果我尝试回滚事务的更改,我会:

C02Q202LG8WL:phpMyAdmin user$ /usr/local/google_appengine/appcfg.py rollback database-140707/
01:30 AM Application: database-140707
01:30 AM Host: appengine.google.com
01:30 AM Rolling back the update.
C02Q202LG8WL:phpMyAdmin user$ appcfg.py update .
01:30 AM Application: database-140707; version: 2
01:30 AM Host: appengine.google.com
01:30 AM Starting update of app: database-140707, module: phpmyadmindb, version: 2
01:30 AM Getting current resource limits.
01:30 AM Scanning files on local disk.
01:30 AM Scanned 500 files.
01:30 AM Scanned 1000 files.
01:30 AM Scanned 1500 files.
01:30 AM Scanned 2000 files.
    Error 409: --- begin server output ---
There is an operation pending for this application: AppLock held for "Updating engine_version_id='2' within engine_id='default'." acquired by <Insert User> at 2016-08-19 08:26:05.734255 GMT.  Please wait and try again or use 'appcfg rollback' to attempt to cleanly abort the current operation.
--- end server output ---

我似乎无法弄清楚为什么我无法在 Google Cloud 上启动 phpMyAdmin,并且我不确定这些错误的原因或来源。任何帮助,将不胜感激。谢谢。

编辑:

我实际上已经正确部署了所有内容。我所要做的就是将 app.yaml 从模块 phpmyadmindb 更改为 default。这是我创建的 app.yaml:

application: database-140707
service: default
runtime: php55
api_version: 1
version: 3

handlers:

- url: /(.+\.(ico|jpg|png|gif))$
  static_files: \1
  upload: (.+\.(ico|jpg|png|gif))$
  application_readable: true

- url: /(.+\.(htm|html|css|js))$
  static_files: \1
  upload: (.+\.(htm|html|css|js))$
  application_readable: true

- url: /(.+\.php)$
  script: \1
  login: admin

- url: /.*
  script: index.php
  login: admin

config.inc.php:

<!-- [START all] -->
<?php
// [START_EXCLUDE silent]
/**
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// [END_EXCLUDE]
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 * http://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator
 */
$cfg['blowfish_secret'] = '<Blow Fish Generator>'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

// Change this to use the project and instance that you've created.
$host = '/cloudsql/<Cloud SQL Instance Name>';
$type = 'socket';

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['socket'] = $host;
$cfg['Servers'][$i]['connect_type'] = $type;
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/*
 * End of servers configuration
 */
/*
* Other settings
*/
$cfg['PmaNoRelation_DisableWarning'] = true;
$cfg['ExecTimeLimit'] = 60;
$cfg['CheckConfigurationPermissions'] = false;
// [END all]

php.ini:

google_app_engine.enable_functions = "php_uname, getmypid"

这是成功的输出:

C02Q202LG8WL:phpMyAdmin schan$ appcfg.py update .
01:12 PM Application: database-140707; version: 3
01:12 PM Host: appengine.google.com
01:12 PM Starting update of app: database-140707, version: 3
01:12 PM Getting current resource limits.
01:12 PM Scanning files on local disk.
01:12 PM Scanned 500 files.
01:13 PM Scanned 1000 files.
01:13 PM Scanned 1500 files.
01:13 PM Scanned 2000 files.
01:13 PM Cloning 1113 static files.
01:13 PM Cloning 2276 application files.
01:13 PM Cloned 2000 files.
01:13 PM Uploading 3 files and blobs.
01:13 PM Uploaded 3 files and blobs.
01:13 PM Compilation starting.
01:13 PM Compilation completed.
01:13 PM Starting deployment.
01:13 PM Checking if deployment succeeded.
01:13 PM Deployment successful.
01:13 PM Checking if updated app version is serving.
01:13 PM Completed update of app: database-140707, version: 3

我现在遇到的问题是教程说导航到 https://phpmyadmindb-dot-database-140707.appspot.com/ 以查看 phpmyadmin 设置正确。然而,当我导航到那里时,我得到的只是一个显示 Hello World! 的屏幕,但似乎没有部署实际的 phpMyAdmin。我尝试访问 https://phpmyadmindb-dot-database-140707.appspot.com/index.php 来查看是否已创建,但事实并非如此。有人知道为什么吗?

最佳答案

日志表明您的应用程序有多个服务/模块 - 我看到日志引用了 phpmyadmindb 服务/模块,并且还有适用于任何应用程序的 default 模块。也许您刚刚错过了 Create app.yaml 中的这一步教程部分:

  1. If you are deploying phpMyAdmin as the first and only application in App Engine, change the value for service from phpmyadmin to default.

Normally, you would deploy phpMyAdmin as a service of an existing application and provide a name for the service. However, if you haven't yet deployed an application, then you are required to use the service name "default". That's fine for the purposes of this tutorial if you're just trying out phpMyAdmin on App Engine.

就我个人而言,我会将该段落中的App Engine 中的第一个且唯一的应用程序替换为您的应用程序的第一个且唯一的服务。无论如何...

对于多模块应用程序,您不应在典型的应用程序中使用 SDK 实用程序(dev_appserver.pyappcfg.py 等)/通常记录的方式 - 通过指定应用程序的目录(在您的情况下是 . )。换句话说,不要让这些实用程序自行决定要操作哪些服务(这可能会导致意外结果),而是习惯通过相应服务/模块的 .yaml 列表来显式指定它们> 文件。

许多文档/教程在引入服务支持后并未更新,并且仍然建议在使用 SDK 实用程序时指定应用程序(通过 ID 或应用程序目录) - 这只是明确的在单模块应用程序中。通过各自的 .yaml 文件显式指定服务/模块,对于单一服务和多服务应用来说仍然是明确的,并且对人为错误的容忍度较低。顺便说一句,这是目前 dev_appserver.py 的默认值(SDK 1.9.40),但仍然不是 appcfg.py 的默认值(使用 - 运行它们) -help 检查语法)。

返回您的案例详情...

更新和回滚错误都表明尝试针对的是 phpmyadmindb 模块,但第二个错误表明锁定是针对 default 模块的更新。尝试显式回滚 default 模块的更新(如果确实错过了,则在执行引用的步骤之后),希望这将释放锁定并允许后续部署。

还要检查 .yaml 文件中是否存在正确的服务/模块名称 - 很容易错过,尤其是在创建新服务并从现有模块复制粘贴文件时。此类情况以及服务/模块名称的更改可能会导致 SDK 实用程序和/或应用程序/服务/模块部署困惑,应谨慎处理。

关于php - 无法启动 Google Cloud phpMyAdmin 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39034577/

相关文章:

javascript - 表单提交按钮不适用于 AngularJs

MySQL C API mysql_query

python - webapp2 请求参数/处理程序参数的自动转换?

google-app-engine - 我们应该将 App Engine 上下文存储在全局变量中还是为每个请求都创建它?

php - 什么更好?国家、州和城市是否在数据库中?

php - 我将如何使用 PHP 来处理占位符 div,然后是 "overwritten"?

php - 在 PHP 中调用带参数的 Javascript 函数

MySQL COUNT 查询时间太长

mysql - 计算特定日期具有相同列值的行数

google-app-engine - 如何在没有 PEM 编码的 RSA 私钥的情况下在 Google Cloud Platform 上设置 SSL 证书