简体   繁体   中英

Why isn't my php page found? Is it an issue with my yaml file?

I am currently working on an interface to run SQL queries to my mySQL database on the google cloud platform. I have PHP, HTML, and YAML files. I have gotten my HTML to launch, but for some reason, every time I try run the query, I am taken to this page: HTML Error 500

I don't think it is the PHP or HTML that is the issue because when I added a test HTML button, that worked on my local machine. My yaml file is this:

service: default
runtime: php55

handlers:

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

- url: /$
  static_files: index.html
  upload: index.html

- url: /(.*)
  static_files: www/\1
  upload: www/(.*)

Does anyone understand if there is something I am doing wrong in this configuration? My php file is called sql.php and the main html file is called index.html Thank you!

Can you try

- url: /(.*\.php)$
  script: \1

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM