0

I am trying to deploy a Codeigniter site to Googe App Engine PHP 7. The site includes a contact form plugin that exists in the data folder outside the Application folder like this:

Root
--application
--data
--css
--js
--system

When I access this page from the Cloud Shell localhost, it loads perfectly:

https://8080-dot-1234567-dot-devshell.appspot.com/data/contact.php

But after I deploy this site to Google App Engine and try to access the page, it returns a 404 Not Found error:

https://mysite.appspot.com/data/contact.php

Can someone explain why the page works over localhost but not when deployed to Google App Engine?

DanielAttard
  • 3,046
  • 8
  • 44
  • 93
  • I'm not using an .htaccess file because that is not supported on Google App Engine. – DanielAttard Nov 22 '19 at 19:58
  • ok, removed comment – Vickel Nov 22 '19 at 19:59
  • I found interesting the difference between the Project IDs in your description. On the first one you used 'devshell' while on the other one you used 'mysite'. This could indicate that you're referring to different projects or services, meaning that it's intended that the file or endpoint is not found. – Kevin Quinzel Nov 27 '19 at 22:07

1 Answers1

1

The location of the app.yaml file is crucial in such cases: the directory in which this file is located is considered the top level of your application. Which has 2 main implications:

  • all artifacts needed by the application must be located somewhere inside this app top level directory, the app deployment process won't look outside it. I suspect this to be your case - if your app.yaml file is inside the application dir and the data dir being outside it. It might be possible to work around this by symlink-ing the necessary artifacts/directories from outside the top level dir to inside it (see How to upload a Google App Engine (Go) project in a different folder than the app.yaml), but that doesn't work for all runtimes.
  • the paths for accessing artifacts in your app need to be relative to the app top level directory.

The development server for some runtimes includes checks for these (making your app behave closer to how it will behave when deployed on GAE) but not all runtimes have this (and some don't even have a dedicated development server), leaving room for such discrepancies between the live and development app.

Note: what's referred to by "application" in this context is really a GAE service/module (they're the same in the case of single service app). But in the case of a GAE app with multiple services all these considerations need to be applied to each app service. Potentially of interest for such case: Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?

Dan Cornilescu
  • 37,297
  • 11
  • 54
  • 89