This page covers how to migrate your PHP 5.5 app to the PHP 7+ runtime on the App Engine standard environment.
Compatibility issues between PHP 5.5 and PHP 7+
The official PHP documentation provides information on migrating from different PHP versions:
- Migrating from PHP 5.5.x to PHP 5.6.x
- Migrating from PHP 5.6.x to PHP 7.0.x
- Migrating from PHP 7.0.x to PHP 7.1.x
- Migrating from PHP 7.1.x to PHP 7.2.x
- Migrating from PHP 7.2.x to PHP 7.3.x
- Migrating from PHP 7.3.x to PHP 7.4.x
- Migrating from PHP 7.4.x to PHP 8.0.x
- Migrating from PHP 8.0.x to PHP 8.1.x
The PHP 7+ runtimes do not allow the
script handler element to be
customized. The only valid value is
auto, because all traffic is served using
the entrypoint command. All non-static URL handlers must include
to deploy successfully.
The behavior of some elements in the
app.yaml configuration file has been
|Added||Optionally, use this field to specify the command that will run when your app starts.|
|Deprecated||All applications are presumed to be threadsafe, meaning an instance can handle multiple requests at the same time.|
|Deprecated||Previously required but not needed in the PHP 7+ runtimes.|
party dependencies can be installed using a |
If you use of any of the deprecated fields, there will be an error on app deployment.
For more information, see the
Reduced runtime restrictions
The PHP 7+ runtimes have fewer restrictions compared to the PHP 5.5 runtime.
- Install third-party dependencies.
- The runtime includes a full filesystem.
- Create background threads or processes that live beyond the scope of the request while the instance runs.
- Use the Google Cloud Client Library for PHP to integrate apps with other Google Cloud services. For more information, see the Installing the Google Cloud Client Library page.
For more information, see the PHP 7+ runtime environment documentation.
Migrating from the App Engine PHP SDK
To reduce runtime migration effort and complexity, the App Engine standard environment allows you to access many of legacy bundled services and APIs in the PHP 7+ runtime, such as Memcache. Your PHP 7+ app can call the bundled services APIs through the App Engine SDK for PHP 7+, and access most of the same functionality as on the PHP 5 runtime. Not all the legacy bundled services available for PHP 5 have a corresponding service in PHP 7+. For the full list of legacy bundled services APIs available for PHP 7+, see the legacy bundled services API references documentation.
You also have the option to use Google Cloud products that offer similar functionality as the legacy bundled services. These Google Cloud products provide idiomatic Google Cloud CLI client library. For the legacy bundled services that are not available as separate products in Google Cloud, such as search, you can use third-party providers or other workarounds. To learn more about migrating to unbundled services, see Migrating from bundled services.
Running your application locally
To test your application and run it locally:
- Locally install a version of PHP that corresponds to one of the PHP 7+ runtimes available on the App Engine standard environment.
- Install a web server and use this to serve your app locally.
For example, start the HTTP server by running the following command:
php -S localhost:8080
Then, view your application in your web browser at http://localhost:8080.