php - 如何让我的应用程序在 appengine 上运行

标签 php mysql google-app-engine

我以通常的方式开发了一个 Web 应用程序并托管在普通的共享服务器上。

这就是我所说的通常的意思

  • 包含我的 PHP 函数文件(使用 php include/require)
  • 将我的普通 MySQL 数据库与 msqli 一起使用
  • 使用 FTP 将我的文件正常上传到服务器。

由于某些原因,我需要将网络应用程序移至 appengine,我已成功上传文件,但它显示了此错误:

500 Server Error

我的日志中出现此错误:

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
ImportError: No module named index

我需要对我的文件进行哪些更改才能使我的网站在 appengine 上正常运行而不会出现问题?

编辑(app.yaml 的内容)

application: gcdc2013-myworkset
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: index.php

- url: /css
  static_dir: stylesheets

- url: /images
  static_dir: images

libraries:
- name: webapp2
  version: "2.5.2"

我尝试将运行时更改为 php,但它给出了一个错误,该错误立即清除,我将其改回 python27

编辑:

更新了 app.yaml 文件(项目现已部署,但所有 PHP 文件都显示此错误:无法猜测 excel/excel_reader.php 的 mimetype。使用 application/octet-stream。 此外,在浏览器上查看时,该项目显示为空白):

application: gcdc2013-myworkset
version: 1
runtime: php
api_version: 1

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: index.php

- url: /
  script: index.php

- url: /index\.php
  script: index.php

- url: /features
  script: features/index.php

- url: /about
  script: about/index.php

- url: /oauth2callback/?
  script: signup.php  

- url: (.*)\.[\d]{10}\.(css|js)
  static_files: $1.$2
  upload: (.*).(.*)

- url: /css
  static_dir: css

- url: /js
  static_dir: js

另外,如何将从本地主机导出的 mysql 数据库导入到 appengine?

最佳答案

更改:

runtime: python27

致:

runtime: php

并删除:

libraries:
- name: webapp2
  version: "2.5.2"

参见https://developers.google.com/appengine/docs/php/config/appconfig了解更多信息。

关于php - 如何让我的应用程序在 appengine 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19962449/

相关文章:

javascript - 如何使用php中的explode函数拆分数据库中的值

php - supervisord 进程不会重新加载新的 php 代码

mysql - 多列索引对单列也有用吗?

android - MySQL 关系和实体

python - Datastore 中的一对多关系和 Google App Engine 中的取消引用

python - NDB .order 返回空结果

php - STR_TO_DATE mysql 和 php

php - 您如何使用脚本语言(PHP、Python 等)来提高您的生产力?

php - 警告:mysqli::query():无法获取 mysqli - PHP7.1 和 MySQL5.7

java - 有没有办法使用 JDO 在 GAE/J 中拥有非持久字段?