我有一个非常简单的PHP应用程序,允许用户在搜索框中输入城市或邮政编码的名称,用户可以根据我的Google CloudSQL服务器中存储的数据获取自动完成的建议。
index.html - 呈现一个简单的搜索框,用户可以在其中输入搜索关键字,并获得自动完成的建议。通过Twitter的typeahead.js库(jQuery插件)完成。
city.php - 充当翻译层的PHP文件。接收来自浏览器的请求并启动与我的Google CloudSQL服务器的连接,其中我有一个包含城市和邮政编码数据的简单数据库。将数据作为数组返回给浏览器。
这适用于我当地的Mac OS X Apache服务器。我正在尝试将此设置用于Google PHP AppEngine。我创建了一个app.yaml文件,如下所示:
runtime: php55
api_version: 2
threadsafe: true
handlers:
- url: /
static_files: index.html
upload: index.html
- url: /(.*)
static_files: www/\1
upload: (.*)
- url: /(.+\.php)$
script: \1
这是我遇到问题的地方。当我从我的本地文件夹(包含index.html,city.php和app.yaml)运行gcloud app deploy时,我在日志中收到以下消息。
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[/Users/arjunshah/.config/gcloud/logs/2016.11.13/12.31.04.137587.log].
当我使用日志详细程度运行gcloud app deploy时,我看到以下内容:
INFO: Could not find any remote repositories associated with [/Users/arjunshah/Documents/autocomplete]. Cloud diagnostic tools may not be able to display the correct source code for this deployment.
File upload done.
INFO: Manifest: [{'app.yaml': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/abbe3c7fc03eb43497686990488c54e2ae0533ea', 'sha1Sum': 'abbe3c7fc03eb43497686990488c54e2ae0533ea'}, 'index.html': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/1865620cc55de1902c2a9636df601f532cb2657a', 'sha1Sum': '1865620cc55de1902c2a9636df601f532cb2657a'}, 'city.php': {'sourceUrl': 'https://storage.googleapis.com/staging.ashah-146101.appspot.com/64999cc8da06416a54be99c43e6e017aa0c1d01a', 'sha1Sum': '64999cc8da06416a54be99c43e6e017aa0c1d01a'}}]
Updating service [default]...
INFO: Previous default version [ashah-146101/default/20161113t122802] is an automatically scaled standard environment app, so not stopping it.
index.html页面加载正常,但是当我尝试输入城市名称(我知道在数据库中)时,我在Google浏览器检查元素控制台中看到以下错误。
Failed to load resource: https://ashah-146101.appspot.com/city.php?query=P the server responded with a status of 404 ()
请帮忙!