All Products
Search
Document Center

Serverless App Engine:Deploy a PHP application

Last Updated:Apr 01, 2026

Package your PHP application as a ZIP file and deploy it to Serverless App Engine (SAE) using code package deployment.

Prerequisites

Before you begin, make sure you have:

Deploy the application

  1. Log on to the SAE console, go to Applications > Applications in the left-side navigation pane, select a deployment region, and then click Create Application.

    If Applications > Applications is not in the navigation pane, go to Applications > Microservice Applications instead.
  2. Select an application version.

    Important

    Lightweight Edition and Professional Edition are currently in invitation-only testing. If you are not participating in invitation-only testing, the application defaults to Standard Edition and you do not need to select a version.

    EditionApplication monitoringMicroservice governance
    Lightweight EditionNot supportedNot supported
    Standard EditionBasic Application Monitoring included; Advanced Application Monitoring requires additional purchaseRequires additional activation and purchase
    Professional EditionAdvanced Application Monitoring includedIncluded
  3. On the Create Application page, enter an Application Name and configure the following settings.

    a. Select a namespace.

    A namespace maps to a Kubernetes namespace and provides resource isolation across environments. You cannot change the namespace after the application is created.

    • System Created: Use the default namespace, vSwitch, and security group that SAE creates in the selected region.

    • Existing Namespace: Select a namespace, vSwitch, and security group that you created in advance.

    b. Configure code package deployment.

    For Application Deployment Method, select Code Package Deployment, then click Configure Code Package Deployment. Under Technology Stack Language, select PHP and the PHP environment that matches your code.

    Configure the following parameters, then click OK.

    ParameterDescription
    Upload MethodUpload a local ZIP file, or enter the URL of a code package.
    VersionEnter a version number, or click Use Timestamp As Version Number.
    Time Zone SettingsSelect the time zone for the application.
    Startup CommandLeave blank if your package follows PHP code package specifications.
    Custom Runtime Environment Settings(Optional) Pre-install tools, download or modify files, and install runtime dependencies or extensions. Options include PHP Extensions, PHP PECL Extensions, and Customize The Runtime Environment By Command Line. See the example below.
    Custom Php.ini(Optional) Enter the content of your php.ini configuration file. Set Php.ini Mount Path to the mount path, for example /usr/local/etc/php/php.ini.

    Custom runtime environment example

    The following script installs the gd extension with common image format support:

    #!/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

    Verify php.ini configuration

    After deployment, run the following command in Webshell to confirm that your php.ini file is loaded:

    php -i | grep ini

    Expected output:

    Loaded Configuration File => /usr/local/etc/php/php.ini

    c. Configure capacity.

    In the Capacity Settings section, set Single Instance Type and the number of Instances.

  4. (Optional) Click Next: Advanced Settings to configure additional features.

    Runtime environment and lifecycle

    Network access

    Data persistence

    Store data in Apsara File Storage NAS, Object Storage Service (OSS), or a database to prevent data loss. Additional fees apply.

    Logs and monitoring

    • View real-time logs and resource usage immediately after deployment, without additional configuration. Optionally, forward logs to Simple Log Service (SLS) or ApsaraMQ for Kafka for centralized analysis. Additional fees apply.

    • Application Real-Time Monitoring Service (ARMS) helps you identify slow or failing interfaces, trace performance bottlenecks, and reproduce call parameters.

      • Standard Edition: ARMS Basic Edition monitoring is available after deployment. Activate ARMS Pro monitoring separately (additional fees apply).

      • Professional Edition: Enable Application Monitoring in Advanced Settings to access ARMS Pro monitoring at no additional cost.

    Other features

    • Microservice Governance enables Lossless Online And Offline, Traffic Protection, End-to-end Grayscale, and Same-zone Routing Priority for Java applications.

      • Standard Edition: Activate after deployment (additional fees apply).

      • Professional Edition: Enable Microservice Governance in Advanced Settings to configure Lossless Online And Offline at no additional cost. For additional governance features, go to the application details page after deployment to configure.

    • Enable the CPU Burst feature (Standard Edition and Professional Edition only) to handle higher CPU load during application startup.

    • Add Sidecar containers to separate non-business functions from the main container.

  5. Click Create Application.

Verify the deployment

Creating an application takes 1–2 minutes. To confirm the deployment succeeded:

  1. Go to Applications > Applications in the SAE console. The application appears in the list with a Running status when deployment is complete.

  2. Click the application name to open its details page, then check Change History for the deployment status. A successful deployment shows all instances in a running state. If the deployment failed, no instances are created — review the error details in Change History to troubleshoot.

  3. (Optional) Click Webshell on the details page to open a browser-based terminal and interact with a running instance directly.

What's next

After your application is running, you can: