Deploy a PHP application

更新时间:
复制 MD 格式

Package your PHP application as a ZIP file that meets SAE requirements, and then deploy it to SAE.

Procedure

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

  2. Select an application edition.

    Important

    The Lightweight Edition and Professional Edition are in an invite-only beta phase. If you are not part of the beta test, your application defaults to the Standard Edition, and you do not need to select an edition.

    • Lightweight Edition: Provides the minimum feature set required to run an application. This edition does not support the Application Monitoring and Microservices Governance features.

    • Standard Edition: Includes the Basic Application Monitoring feature. The Advanced Application Monitoring and Microservices Governance features must be enabled and purchased separately.

    • Professional Edition: Includes the Advanced Application Monitoring and Microservices Governance features. They do not need to be enabled or purchased separately.

  3. On the Create Application page, enter an Application Name and configure the following parameters.

    1. Select a namespace type for the application. A namespace is equivalent to a Kubernetes namespace and isolates resources across different environments. You cannot change the namespace of an application after it is created. Plan your resources accordingly.

      • System Created: Uses the default namespace, vSwitch, and security group that are automatically created by the system in the current region.

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

    2. For Application Deployment Method, select Code Package-based Deployment, and click Configure Code Package-based Deployment. For Technology Stack Programming Language, select PHP. Choose a PHP environment that is compatible with your code. Configure the following parameters, and click OK.

      Parameters

      Parameter

      Description

      Upload Method

      Upload a local code package or enter the URL of the package.

      Version

      Enter an application version number or select Use Timestamp as Version Number.

      Time Zone Settings

      Select the time zone where the application runs.

      Startup Command

      If you packaged your application 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.

      • PHP Extension.

      • PHP PECL Extension.

      • Customize the runtime environment by command line: 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

      Custom php.ini

      (Optional) When enabled, enter the content of the php.ini configuration file. SAE starts the application by using this 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, you can run the following command in Webshell to verify that the configuration file was mounted successfully:

      php -i | grep ini
      # Example output: Loaded Configuration File => /usr/local/etc/php/php.ini
    3. In the Capacity Settings section, configure Resource Type, Single Instance Specification, and Number of Instances.

      Resource type

      Resource Type can be set to Default or Hygon. The Hygon resource type is in an invite-only beta phase. If you are not part of the beta test, Resource Type defaults to Default, and no selection is required.

      To use Hygon resources to deploy an application, contact technical support in the DingTalk group (ID: 32874633) to enable this feature. You must also select a region and zone that support Hygon resources:

      • China (Shanghai): Supports Zone B, Zone G, and Zone L.

      • China (Beijing): Supports Zone H, and Zone I.

      • China (Hangzhou): Supports Zone J.

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

    • Runtime environment and lifecycle management

    • Network access and service invocation

    • Data persistence

      Store application data in NAS, OSS, or a database to prevent data loss when you update or stop the application. Note that NAS, OSS, and databases are subject to additional charges.

    • Logging and monitoring

      • After deployment, you can view real-time logs and monitor resource usage and load without extra configuration. You can also export logs to SLS or Kafka for centralized management and analysis. Note that SLS and Kafka are subject to additional charges.

      • ARMS monitoring provides a comprehensive view of your application's health. It helps you quickly identify faulty or slow API calls, detect performance bottlenecks, and reproduce call parameters, which significantly improves the efficiency of troubleshooting online issues.

        • For Standard Edition applications, you can view basic ARMS monitoring data after deployment without extra configuration. You can also purchase and enable advanced ARMS monitoring.

        • For Professional Edition applications, enable Application Monitoring in the Advanced Settings. After the application is deployed, you can view advanced ARMS monitoring data. No additional fees are required.

    • Other features

      • Microservices Governance enables features for Java applications such as graceful start and shutdown, traffic protection, end-to-end canary release, and prioritized routing to providers in the same zone.

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

        • For Professional Edition applications, enable Microservices Governance in the Advanced Settings to configure graceful start and shutdown. You can configure more features on the application details page after deployment. No additional fees are required.

      • Enable the CPU Burst feature to manage the higher CPU demand during startup and loading without wasting resources during normal operation.

      • Add a sidecar container to decouple and standardize non-business functionalities from the main application container.

      • Enable RRSA identity authentication to manage API permissions at the application instance level, which avoids the security risk of key leakage inherent in traditional key-based authentication.

  5. Click One-Click Create Application or Create Application.

    • Application creation takes about 1 to 2 minutes. You can view the change records to check if the deployment is successful. If the deployment fails, SAE does not create any instances. Troubleshoot the issue based on the error message in the Change Details.

    • You can view your created applications on the page. To modify the application configuration after deployment, click the target application to go to its details page. At the top of the page, click Deploy Application or Modify Application Configurations. Note that the application automatically restarts for the new configuration to take effect, so you should perform this operation during off-peak hours.

    • You can log on to an application instance by using Webshell and interact with it through console commands.

    • After creating the application, you can manually adjust the number of instances and the instance specification, or configure an auto scaling policy. You can also enable idle mode to reduce costs.