php - 为什么找不到我的 php 页面?我的 yaml 文件有问题吗?
问题描述
我目前正在开发一个界面,以便在谷歌云平台上对我的 mySQL 数据库运行 SQL 查询。我有 PHP、HTML 和 YAML 文件。我已经启动了我的 HTML,但由于某种原因,每次我尝试运行查询时,我都会被带到这个页面:HTML 错误 500
我不认为是 PHP 或 HTML 是问题,因为当我添加一个测试 HTML 按钮时,它在我的本地机器上工作。我的 yaml 文件是这样的:
service: default
runtime: php55
handlers:
- url: /(.+\.php)$
script: \1
- url: /$
static_files: index.html
upload: index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
有谁知道我在这个配置中做错了什么?我的 php 文件名为 sql.php,主 html 文件名为 index.html 谢谢!
解决方案
You would also need to define your environment variables in the app.yaml file.
Here is an example from GCP GitHub repository:
# [START gae_php_mysql_env]
env_variables:
# Replace USER, PASSWORD, DATABASE, and CONNECTION_NAME with the
# values obtained when configuring your Cloud SQL instance.
MYSQL_DSN: mysql:unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME;dbname=DATABASE
MYSQL_USER: USER
MYSQL_PASSWORD: PASSWORD
# [END gae_php_mysql_env]
Remember - storing secrets in plaintext is potentially unsafe. Consider using something like https://cloud.google.com/kms/ to help keep secrets secret.
推荐阅读
- wordpress - 如果 WordPress 类别为空,如何显示一行文本?
- r - order 函数如何打破 R 中的关系?
- xamarin.forms - Xamarin 跨平台蓝牙连接示例代码
- ruby - OpenSSL::X509::CertificateError:嵌套 asn1 错误
- angularjs - 使用Springboot从angularjs上传图像到FTP
- c# - 如何按键组合字典和列表
- python - 可以使用混合模式使用 Matplotlib 渲染在 Python 中绘制的点吗?
- jquery - 循环 jquery fadeIn() fadeOut() 出现问题
- ios - Swift 将数据转换为 UnsafeMutablePointer
- python - 如何从python中元素之间的关键字列表中删除元素