How to reference nested requires in app.yaml for A

2019-09-18 20:03发布

I have a index.php with a

require 'myfolder/folder/lib1.php';

So in app.yaml I reference:

- url: /myfolder/folder/lib1.php
  script: myfolder/folder/lib1.php

but this lib1.php does another require 'lib2.php'; at same folder level /myfolder/folder/. So it trows error 500 because it can't find lib2.php. How can I properly reference them both in app.yaml?

3条回答
不美不萌又怎样
2楼-- · 2019-09-18 20:21

The problem you face is most likely independent to Google App Engine. On Google App Engine, the standard rules of PHP file-inclusion still applies. The only potential difference here is that the files are read-only (but that should not pose any problems in your case).

So if lib1.php requires lib2.php you need to require the later before you require the other. That is standard PHP behavior:

require 'myfolder/folder/lib2.php'; 
require 'myfolder/folder/lib1.php';

To learn more what exactly caused the 500 error on Google App Engine, consider downloading the log and look into it. This is also independent to Google App Engine, because that is the best suggestion one can give with any webserver on 500 errors.

查看更多
Lonely孤独者°
3楼-- · 2019-09-18 20:23

Your app.yaml file is for routing requests from incoming URLs to the initial script you want to use to process the request.

You don't need to add routings for each and every *.php file that you want to include from one script to another.

For example, look at the app.yaml example for running wordpress. It just has the URLs that clients will access, but not all of the php scripts used by wordpress.

查看更多
Viruses.
4楼-- · 2019-09-18 20:36

The error 500 was thrown basically because Google App Engine for php doesn't support CURL extension used in the Facebook php SDK. Nothing related to app.yaml includes. I forked the official fb sdk git and I'm patching a solution right now.

查看更多
登录 后发表回答