All Products
Search
Document Center

Serverless App Engine:Deploy a PHP application

Last Updated:Aug 26, 2026

Package your PHP application as a ZIP file that meets Serverless App Engine (SAE) requirements, and then deploy the package to SAE as an application.

Prerequisites

Application editions

Important

The Lightweight Edition and Professional Edition are currently in an invite-only beta phase. For users not participating in the beta test, applications are created as the Standard Edition by default.

The following table describes the features that each edition includes.

EditionIncluded features
Lightweight EditionProvides the minimum feature set required to run an application. Does not support the Application Monitoring and Microservices Governance features.
Standard EditionIncludes the Basic Application Monitoring feature. The Advanced Application Monitoring and Microservices Governance features must be enabled and purchased separately.
Professional EditionIncludes the Advanced Application Monitoring and Microservices Governance features, which do not need to be enabled or purchased separately.

Microservices Governance provides its features for Java applications. Because the editions differ only in the features listed in the preceding table, application monitoring is the capability to weigh when you choose an edition for a PHP application. For the monitoring data and the governance features that each edition provides, see the "Advanced settings" section of this topic.

Create the application

  1. On the SAE Application List page, select the target region and namespace in the top navigation bar, and then click Create Application.

  2. Select an application edition. For a comparison of the editions, see the "Application editions" section of this topic.

  3. On the Create Application page, enter a custom Application Name.

  4. Select the namespace type for the application. A namespace is equivalent to a Kubernetes namespace and can be used to isolate resources in different environments.

    Important

    You cannot change the namespace of an application after it is created. Confirm which namespace the application belongs to before you create it.

    • System Created — Use the default namespace, vSwitch, and security group created by the system in the current region. Select this option when the application does not need to reuse existing network resources.

    • Existing Namespace — Select the namespace, vSwitch, and security group that you created in advance. Select this option when the application must run in network resources that you prepared.

  5. Set Application Deployment Method to Code Package-based Deployment, and then click Configure Code Package-based Deployment on the right.

  6. For Technology Stack Programming Language, select PHP, and then select the PHP environment that is compatible with your code.

  7. Configure the code package parameters, and then click OK. The parameters are described in the "PHP ZIP package parameters" section of this topic.

  8. In the Capacity Settings section, set Resource Type, Single Instance Type, and Instances.

  9. (Optional) Click Next: Advanced Settings to configure desired features. The available features are described in the "Advanced settings" section of this topic.

  10. Click Create Application with One Click or Create Application.

PHP ZIP package parameters

The following table describes the parameters that you configure for a PHP ZIP package.

ParameterDescription
Upload MethodUpload a local code package or enter the URL of the code package.
VersionEnter an application version number or select Use Timestamp as Version Number.
Time Zone SettingsSelect the time zone in which the application runs.
Startup CommandIf you packaged your code according to the PHP code package specifications, you do not need to configure a startup command.
Custom Runtime Environment Settings(Optional) If enabled, you can pre-install tools, download or modify files, and install runtime dependencies or extensions for your application as needed.
Custom php.ini [TODO: confirm UI term](Optional) When enabled, enter the content of the php.ini configuration file. SAE starts the application by using this configuration.

Customize the runtime environment

If you turn on Custom Runtime Environment Settings, you can configure the following items:

  • PHP Extension.

  • PHP PECL Extension.

  • Customize the runtime environment by using the command line. The following script is an example:

    #!/bin/bash
    docker-php-ext-configure gd                 \
            --with-gd                           \
            --with-webp-dir                     \
            --with-jpeg-dir                     \
            --with-png-dir                      \
            --with-zlib-dir                     \
            --with-xpm-dir                      \
            --with-freetype-dir                 \
    && docker-php-ext-install -j$(nproc) gd

Customize the php.ini configuration

In php.ini Mount Path, set the mount path of the configuration file, for example, /usr/local/etc/php/php.ini.

After the application is deployed, run the following command in Webshell to verify that the configuration file is mounted:

php -i | grep ini
# Example output: Loaded Configuration File => /usr/local/etc/php/php.ini

Advanced settings

In Advanced Settings, you can configure the following optional features for the application.

Note

The following features rely on services that incur additional charges: the MSE service registration and discovery center, NLB, CLB, gateway routes, NAT Gateway, elastic IP addresses (EIPs), NAS, OSS, databases, Simple Log Service, and Kafka.

Runtime environment and lifecycle

Network access and service invocation

Data persistence

Store application data in NAS, OSS, or a database to prevent data loss when an application is changed or stopped.

Logging and monitoring

  • Logs and metrics — After you deploy an application, you can view real-time logs and view resource usage and load without additional configuration. You can also output logs to Simple Log Service or Kafka for centralized management and analysis.

  • Application monitoring — ARMS helps you track application health, quickly find failed and slow APIs, identify performance bottlenecks, and reproduce call parameters, which improves production troubleshooting efficiency.

    • For Standard Edition applications, you can view ARMS Basic Edition monitoring data after deployment without additional configuration. You can also enable and purchase ARMS Premium Edition monitoring.

    • For Professional Edition applications, after you enable Application Monitoring in Advanced Settings and deploy the application, you can view ARMS Premium Edition monitoring data. No additional fees are required.

Other features

  • Microservices Governance — Microservices Governance provides Graceful Start and Shutdown, traffic protection, end-to-end canary release, and Intra-zone Provider First for Java applications. Consider this scope before you enable the feature for a PHP application.

    • For Standard Edition applications, go to the application details page after deployment to enable and purchase the MSE Microservices Governance feature.

    • For Professional Edition applications, after you enable Microservices Governance in Advanced Settings, you can configure Graceful Start and Shutdown. For more features, go to the application details page after deployment. No additional fees are required.

  • CPU Burst — You can enable the CPU Burst feature to avoid wasting resources when CPU requirements are higher at startup than during normal operation.

  • Sidecar containers — You can decouple and standardize non-business features from the main container by adding a sidecar container.

Verify the deployment

Creating the application takes about 1 to 2 minutes. Verify the result as follows:

  • The application appears on the Application List page.

  • You can view change records to verify that the deployment was successful.

Handle a failed deployment

If the deployment fails, no application instance is created. Troubleshoot the issue based on the error message in Change Details.

Next steps