I deployed my PHP application for the first time on Google App Engine via Google Cloud SDK CLI. it contains 4 php files. All the php files are in the same folder.
Here is my issue. When I run my application, it only shows content of index.php
file, irrespective of the PHP file that I call from the browser. How can I debug this?
Here is my app.yaml
file
runtime: php81
handlers:
# Serve php scripts.
- url: /(.+\.php)$
script: \1
You're using php8 and GAE has a different way of handling it from php 5 (the document you referred to).
According to the documentation, you should either deploy a front controller to handle the routing or you code your index.php
file to do that. The doc provided the following sample for using index.php
switch (@parse_url($_SERVER['REQUEST_URI'])['path']) {
case '/':
require 'homepage.php';
break;
case '/contact.php':
require 'contact.php';
break;
default:
http_response_code(404);
exit('Not Found');
}