All Products
Search
Document Center

Serverless App Engine:Deploy a PHP application by using a ZIP package in the SAE console

Last Updated:Apr 01, 2024

After you develop an application, you can deploy the application in the application hosting platform Serverless App Engine (SAE). This topic describes how to deploy a PHP application by using a ZIP package in the SAE console.

Prerequisites

Procedure

  1. Log on to the SAE console.

  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click Create Application.

  3. In the Basic Information step, configure the parameters and click Next: Application Deployment Configurations.

    Parameter

    Description

    Application Name

    Enter a custom application name.

    VPC

    Select a configuration method for the VPC. Valid values:

    • Custom Configuration: If you select this option, you must manually specify the namespace, VPC, vSwitch, and security group for the application that you want to create.

    • Automatic Configuration: If you select this option, SAE automatically specifies the namespace, VPC, vSwitch, and security group for the application.

    Namespace

    This parameter is required if you set the VPC parameter to Custom Configuration.

    Select an existing namespace from the drop-down list. Namespaces and VPCs are in one-to-one mapping relationships. For information about how to modify a VPC, see Create and manage a VPC.

    vSwitch

    This parameter is required if you set the VPC parameter to Custom Configuration.

    Click Select vSwitch. In the Select vSwitch dialog box, select the required vSwitches.

    You must specify at least one vSwitch. We recommend that you specify no more than three vSwitches. Each vSwitch must match at least one application instance.

    Security Group

    This parameter is required if you set the VPC parameter to Custom Configuration.

    Select a security group from the drop-down list. If you have not created a security group in your VPC, click Create Security Group to create a security group as prompted. For more information, see Create a security group.

    Application Instances

    Select the number of instances that you want to create.

    VCPU

    Select a CPU specification for the instances that you want to create.

    Memory

    Select a memory specification for the instances that you want to create.

    Application Description

    Enter a description for the application.

  4. In the Deployment Configurations step, configure the parameters.

    1. Configure the parameters that are used to deploy an application.

      Parameter

      Description

      Technology Stack Programming Language

      Select PHP.

      Technology Stack Version

      This parameter is available only when you set the Technology Stack Programming Language parameter to PHP.

      Select the language version of the PHP application.

      Important
      • You must set the Technology Stack Version parameter to a valid value. An invalid value may cause an exception in the running PHP application.

      • You cannot use ZIP packages to deploy applications in Alpine images.

      Application Deployment Method

      Select Deployment with ZIP Packages.

      Runtime Component

      Select an environment from the PHP Environment drop-down list.

      File Upload Method

      Select Upload ZIP Package or ZIP Package Address.

      • Upload ZIP Package: Click Select File and select the ZIP package that you want to use.

      • ZIP Address: Enter the directory in which the ZIP package is stored.

      Note
      • Format of the package name: The package name can contain only letters, digits, hyphens (-), and underscores (_), and the extension must be .zip. This format is the same as the name format of the WAR package and JAR package that are used to deploy Java applications.

      • Structure of the package directory: You must follow the requirements on the directory structure of the ZIP package. For more information, see Create a ZIP package for a PHP application.

      Version

      The version number of the application. Enter a version number or click Use Timestamp as Version Number.

      Time Zone

      Select the time zone of the application. Example: UTC+8.

      Custom Runtime Environment Settings (including tool pre-installation, file download/modification, and runtime dependency/extension installation)

      Select Custom Runtime Environment Settings (including tool pre-installation, file download/modification, and runtime dependency/extension installation), select an extension type based on your business requirements, and then view and debug the code in the preview section on the right side of the parameter.

      • PHP Extensions: Select PHP Extensions and enter parameters in the text box that appears. For more information, see Function Reference.

      • PHP PECL extension: Select PHP PECL extension and enter parameters in the text box that appears. For more information, see Introduction to PECL Installations.

      Note
      • You must separate multiple parameters with line feeds to prevent spaces.

      • For information about how to install third-party extensions, see Support for PHP extensions.

    2. (Optional)Configure the advanced settings based on your business requirements.

  5. Click Next: Confirm Specifications.

  6. In the Specification Confirmation step, view the details of the application and the fee for the selected specifications. Then, click Confirm.

    The Creation Completed step appears. You can click Application Details to go to the Basic Information page of the application.

Verify the deployment result

After an application is deployed, you can use one of the following methods to verify the deployment result for the application.

  • View the running status of application instances.

    1. Log on to the SAE console.

    2. In the left-side navigation pane, click Applications. On the Applications page, click the name of the application that you want to manage.

    3. On the Basic Information page, click the Instance Deployment Information tab to view the running status of the instances.

      If Running or Completed is displayed in the Status column, the application is deployed.

  • Add an Internet-facing Classic Load Balancer (CLB) instance to the application.

    After an application is deployed, you can configure a CLB instance to allow access to the application within a specified period of time for other applications.

    CLB instances are classified into the following types:

    • Internal-facing CLB instance: provides an access portal in the VPC where the application resides to ensure that the application can be accessed by other applications in the same VPC.

    • Internet-facing CLB instance: SAE can automatically purchase an Internet-facing CLB instance for an application, or you can use an Internet-facing SLB instance that you purchased in the CLB console. This helps ensure that the application can be accessed by other applications over the Internet.

    Note

    You can allow access to an application by using an Internet-facing CLB instance the same way you allow access to an application by using an internal-facing CLB instance. For more information, see Bind a CLB instance to an application. After a CLB instance is bound to an application, you can enter a URL that consists of the IP address, port, and access path of the CLB instance in the address bar of your browser to access the application. Example: 192.168.XX.XX:80/image.

References

The following table describes the operations that you can perform on an application after you deploy the application on SAE.

Operation

References

Lifecycle management operations, such as updating, starting, stopping, and deleting an application, and scaling in or scaling out the instances for an application

Manage the lifecycle of an application

Performance optimization operations, such as configuring auto scaling policies for an application, binding Server Load Balancer (SLB) instances to an application, and starting or stopping applications in batches

Application status-based operations, such as managing logs, configuring monitoring settings, viewing application events, and viewing change records