Carboni Tech
Carboni Tech

Reputation: 21

Getting my app.yaml PHP configuration to work in Google App Engine

I'm completely new to Google App Engine, app.yaml has seriously stumped me and I can't figure it out, I've looked everywhere but nothing seems to work. This is my .yaml, everything works on XAMPP but I can't seem to get it to work/function on the App Engine.

runtime: php55
api_version: 1

handlers:

- url: /(.*\.(ico$|jpg$|png$|gif$|htm$|html$|css$|js$|xml$))
  static_files: \1

  upload: (.*\.(ico$|jpg$|png$|gif$|htm$|html$|css$|js$|xml$))
  application_readable: true

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

- url: /
  script: index.php

The includes in my index, such as <?php include "/static/include/header.php";?> does not show up on my page and that file has all my style/css includes etc as well, also how do you process the GET_[] it simply just changes the url but it doesn't get processed by the page. So far I've got my logo.png to show up on my index but that's about it so far, I can't figure it out.

Example: .php?ID=99999999&group=All I assume there's something I need to do to the YAML to actually make the above work.

This page isn’t working ranked.games is currently unable to handle this request. HTTP ERROR 500

That's what I get when I have the above example suffixed.

Upvotes: 2

Views: 304

Answers (1)

GAEfan
GAEfan

Reputation: 11360

There are some issues in your app.yaml. Think of it as a regex matching process that routes requests to the proper destination. The $ goes at the end, not for each possible match.

Try this:

# For better organization, let's put all your static files in a directory called "static", and include files in a directory called `includes`.  A .php script is not a static file

- url: /(.*\.(ico|jpg|png|gif|htm|html|css|js|xml))$
  static_files: static/\1
  upload: static/.*\.(ico|jpg|png|gif|htm|html|css|js|xml)$
  application_readable: true

If you put your include files in a directory called includes, it would look like this:

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

Next, let's not send a junk URL to a script. Let's make sure it matches xxx.php:

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

Upvotes: 2

Related Questions