bokingwen
bokingwen

Reputation: 1

php app.yaml google app engine launcher

I am not a developer recently assigned a task to try put a simple static sites on google web hosting. I am stuck on the app.yaml part. The website works fine on a server I just couldn't get it to work on GAE.

handlers:

- url: /stylesheets
  static_dir: css

- url: /img
  static_dir: img

- url: /js
  static_dir: js

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

- url: .*
  script: index.php 

folder
\css
\img
\js
about.php
footer.php
header.php
home.php
index.php
links.php
menu.php

If I leave the static dir line in the app.yaml the site will not start. If i only leave the script: index.php the page load but only the home page work and the header and footer or the CSS don't work.

I have read the google documents many times and get the hello world to work on my computer just can't get this simple site to work.

Upvotes: 0

Views: 106

Answers (1)

Dan Cornilescu
Dan Cornilescu

Reputation: 39834

Welcome to SO.

Pay attention to the indentation, yaml is sensitive to that - you can have incorrect configs as a result (for example static_dir: css is not properly indented relative to url: /stylesheets, which is likely why you CSS is not working).

I presume the lower portion of the code section in the question is actually an illustration of your dir structure and not part of the app.yaml.file itself (which would be incorrect yaml syntax).

I don't see a favicon.ico file in your dir structure, the respective section in the app.yaml file is presently useless (or, if the file is somewhere else, the section needs to be corrected).

You don't have handlers for the other .php files, they're handled through the .* handler which is index.php (not sure if that's your intention).

You might want to go through this doc, many examples in there: https://cloud.google.com/appengine/docs/php/config/appconfig

Update:

Assuming you want to add script handlers for all those .php files, one of the appconfig doc examples shows:

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

You'd need to place this above the catch-all .* handler (first matching handler is used, order matters).

Upvotes: 1

Related Questions