When deploying an application using a code package, Serverless App Engine (SAE) supports the following technology stacks and runtime environments. Before deployment, you need to create a code package that meets SAE requirements. If your technology stack language and runtime environment are not listed below, you need to deploy an application using an image.
Java
Runtime environment | Update time | JDK version | Operating system version | Open source | Maintained | Description |
Dragonwell 21 | 2024-07-18 | 21.0.3.0.3+9 | CentOS Linux release 7.9.2009 | Yes | Yes | |
Dragonwell 17 | 2022-07-11 | 17.0.3.0.3+7 | CentOS Linux release 7.9.2009 | Yes | Yes | |
Dragonwell 11 | 2021-08-27 | 11.0.10.10-AJDK | CentOS Linux release 7.9.2009 | No | Yes |
|
2020-09-27 | ||||||
Dragonwell 8 | 2021-10-18 | 1.8.0_302 | CentOS Linux release 7.9.2009 | Yes | Yes | Fixed the occasional issue of high CPU utilization. |
2021-08-27 |
| |||||
2020-09-27 | Enabled features such as Wisp coroutine and self-check of compatibility with the NIO client Netty. For more information, see Open source Dragonwell 8. | |||||
OpenJDK 8 | 2019-06-19 | 1.8.0_191 | CentOS Linux release 7.6.1810 | Yes | No | None |
OpenJDK 7 | 2019-02-25 | 1.7.0_201 | CentOS Linux release 7.6.1810 | Yes | No | None |
openjdk-8u191-jdk-alpine3.9 | 2019-02-25 | 1.8.0_191 | alpine 3.9.2 | Yes | No | Some commands in the alpine image are different from those in CentOS. For example:
|
openjdk-7u201-jdk-alpine3.9 | 2019-02-25 | 1.7.0_201 | alpine 3.9.2 | Yes | No | Some commands in the alpine image are different from those in CentOS. For example:
|
PHP
Runtime introduction
Online applications: NGINX with PHP-FPM
SAE provides a LNMP (Linux+NGINX+MySQL+PHP) runtime environment for PHP web applications, which includes:
The default base image of PHP FastCGI Process Manager (FPM).
NGINX.
Common PHP extensions.
If your application requires more resources, you can use the following Alibaba Cloud services:
Application monitoring: ARMS
For SAE applications with PHP versions 5.4 to 7.3, you can enable application monitoring to obtain more detailed monitoring information such as application call chain tracing and resource access latency for ApsaraDB RDS MySQL and Tair (Redis OSS-compatible).For more information, see ARMS application monitoring overview.
PHP runtime description
Software versions
The following table describes the available PHP runtime environments. If you need a higher version of PHP environment, please join the DingTalk group (Group number: 32874633) to consult with product technical experts.
Runtime environment | Update time | PHP version | NGINX version | Operating system version | Description |
PHP-FPM 7.3 | 2021-12-27 | 7.3.32 | 1.18.0 | Debian 11.0 |
|
PHP-FPM 7.2 | 2021-09-17 | 7.2.34 | 1.18.0 | Debian 10.7 | None |
PHP-FPM 7.1 | 2021-09-17 | 7.1.33 | 1.18.0 | Debian 10.2 | None |
PHP-FPM 7.0 | 2021-09-17 | 7.0.33 | 1.18.0 | Debian 9.6 | None |
PHP-FPM 5.6 | 2021-09-17 | 5.6.40 | 1.18.0 | Debian 9.6 | None |
PHP-FPM 5.5 | 2021-09-17 | 5.5.38 | 1.18.0 | Debian 8.5 | None |
PHP-FPM 5.4 | 2021-09-17 | 5.4.45 | 1.18.0 | Debian 8.2 | None |
System directories
The SAE PHP environment uses the following directories by default for application package deployment:
Type | Path | Description |
Directory | /home/admin/app/ | The default directory in which application packages are deployed. |
Directory | /home/admin/app/nginx/ |
|
Directory | /home/admin/app/php/ | The default PHP application directory, which corresponds to the ./php/ directory in the demo package. |
File | /usr/local/etc/php.ini | The recommended php.ini configuration path for SAE. |
The following table describes the default configurations of PHP-FPM:
Type | Path | Description |
Directory | /usr/local/etc/php |
|
Directory | /usr/local/etc/php/conf.d/ | The directory in which the PHP extensions are stored. By default, the extensions are included in .ini files. |
File | /usr/local/etc/php-fpm.conf | The default configuration file for PHP-FPM. For more information, see FastCGI Process Manager (FPM). For information about how to modify the configuration, see Manage and use configuration items (K8s ConfigMap). |
The following table describes the default configurations of NGINX:
Type | Path | Description |
File | /usr/sbin/nginx | The directory of NGINX. |
Directory | /etc/nginx/ | The directory of default NGINX configurations. |
File | /etc/nginx/nginx.conf | The default NGINX configuration file nginx.conf, which includes the |
Built-in extensions
The PHP environment provided by SAE supports the following extensions:
Default PHP extensions: Released with PHP version updates.
PHP PECL community extensions: Released independently and maintained by the community.
Related permissions
By default, PHP-FPM and NGINX use the www-data user to run applications. The following table describes the permissions.
Service | Permission USER GROUP | Description |
PHP-FPM | Process | PHP default, the configuration file path is /usr/local/etc/php-fpm.conf. |
NGINX | Process | NGINX default, the configuration file path is /etc/nginx/nginx.conf. |
File directory | Directory | The directory in which code packages are deployed, the configuration directory is /home/admin/app/. See the following example: |
We recommend that you retain the user to prevent application failures.
PHP extension support
Default and PECL extensions
You can configure the php.ini file to specify built-in extensions when you deploy an application, including the default PHP extensions and PECL extensions.
Run the following command in the webshell to view the built-in extensions. For information about how to open the webshell, see View the webshell.
php -mExamples of built-in extensions supported by different runtime environments:
PECL 7.3
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
mcrypt
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 7.2
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
mcrypt
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 7.1
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
mcrypt
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 7.0
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 5.6
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 5.5
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcachePECL 5.4
[PHP Modules]
amqp
ARMS
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
memcached
mongodb
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
recode
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
timezonedb
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
yaml
zip
zlib
[Zend Modules]
XdebugInstall extensions through the console and API
You can enable default PHP extensions or install specific versions of PECL extensions through the SAE console or API. For more information, see Deploy a PHP application.
Install third-party extensions
This section describes how to install a third-party extension by compiling the YAML file that contains the source code in PHP-FPM 7.3.
Create a SAE application with PHP 7.3 as the runtime environment.
Enable Internet access.
Log on to the instance by using the webshell, and run the following commands to compile and install the extension:
# Get the source code wget https://pecl.php.net/get/yaml-2.2.2.tgz tar -zxvf yaml-2.2.2.tgz # Compile and install the extension cd yaml-2.2.2 && \ phpize && \ ./configure && \ make && make installDownload the extension to your on-premises machine. For more information, see Upload and download files to diagnose applications through logs.
The directory of the extension:
/home/admin/yaml-2.2.2/modules/yaml.soInclude the extension in the ZIP package of the application. ZIP package structure:
. ├── nginx │ ├── default.conf │ ├── fastcgi_params │ ├── global │ └── root.dir ├── php │ ├── index.php └── extensions └── yaml.soDeploy the application, upload the ZIP package that contains the extension, and then add the extension configuration to the php.ini file to enable the extension.
extension=/home/admin/app/extensions/yaml.soLog on to the instance by using the webshell and check whether the extension is loaded.
# php -m | grep yaml yaml
Common configurations
Default service ports
The following table describes the default service ports of NGINX and PHP-FPM configured by SAE:
Program | Port |
NGINX |
|
PHP-FPM |
|
PHP-FPM logs: standard output
PHP-FPM logs are contained in real-time logs. The following sample code provides an example of the log configuration in the /usr/local/etc/php-fpm.d/docker.conf file:
[global] error_log = /proc/self/fd/2 log_limit = 8192 [www] access.log = /proc/self/fd/2The PHP error logs that are not displayed. The following sample code provides an example of the log configuration in the php.ini file.
error_log => no value => no value log_errors => Off => Off log_errors_max_len => 1024 => 1024If you want to include the error logs in real-time logs, you must configure the php.ini file when you create or deploy an application. You must specify the following directory to store the error logs:
log_errors = on error_log = /proc/self/fd/2
NGINX logs: standard output
NGINX logs are contained in real-time logs. The following sample code provides an example of the log configuration in the ./nginx/default.conf file:
#access_log /dev/stdout; error_log stderr;You can enable
access_log. By default, the logs are contained in real-time logs.
File caching: static files, images, and media
You can configure the php.ini file to determine whether to enable OPcache for PHP. SAE enables OPcache by default. For more information about the configuration, see OPcache runtime configuration.
Enable OPcache: This option is suitable for online websites to accelerate code execution and reduce disk input/output (I/O).
Disable OPcache: This option is suitable for debugging scenarios. Code modifications can immediately take effect.
The following sample code provides an example of the php.ini configuration:
; Enable OPcache
opcache.enable=1
; Disable OPcache
;opcache.enable=0File caching: PHP code
You can enable or disable caching in NGINX for many static files, such as images, videos, Cascading Style Sheets (CSS) files, and JavaScript files. For more information about the configuration, see Module ngx_http_headers_module.
Enable static resource caching: This option is suitable for online services and websites that load many media files. This improves traffic throughput and reduces read input/output operations per second (IOPS).
Disable static resource caching: This option is suitable for remote debugging, upload and download, and other usage scenarios. You can access the files in real time.
The following sample code provides an example of the ./nginx/default.conf configuration:
# Static resource caching
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
# Disable caching
#expires off;
# Enable caching
expires 1s;
}Enhanced features
Hot restart services
ConfigMap allows you to modify the configurations without interrupting services.
Webshell allows you to restart services without interrupting services.
Hot restart of NGINX
# Test the validity of the configuration file nginx -t # Restart NGINX without service interruptions nginx -s reloadHot restart of PHP-FPM (There is a certain probability of stream interruption. You need to check the php.ini configuration.)
ps uax | grep 'php-fpm: master' | grep -v grep | awk '{print $2}' | xargs kill -USR2
Upload and download
SAE provides multiple methods to allow you to upload and download files. You can select one of the following methods based on your business requirements:
Use the SAE console: You can upload and download files for debugging. The file size cannot exceed 10 MB. For more information, see Use the webshell feature to upload and download files.
Use the SAE console: You can perform remote debugging.
Use the persistence storage: Apsara File Storage NAS or Object Storage Service (OSS).
When you deploy an application, you can mount NAS or OSS and share file directories.
Upload and download NAS: Serverless Devs tool.
Upload and download OSS: OSS console.
Upload and download OSS: ossutil tool.
Python
Runtime environment | Update time | Operating system version | Description |
Python 3.9.15 | 2022-10-11 | Debian 11.0 |
.NET Core
To facilitate development and deployment, the base images of SAE are built based on the official .NET base images and are preconfigured with common troubleshooting tools and font packages.
Version | Base image | Operating system | Runtime |
3.1 | mcr.microsoft.com/dotnet/aspnet:3.1 | Debian GNU/Linux 10 (buster) |
|
5.0 | mcr.microsoft.com/dotnet/aspnet:5.0 | Debian GNU/Linux 10 (buster) |
|
6.0 | mcr.microsoft.com/dotnet/aspnet:6.0 | Debian GNU/Linux 11 (bullseye) |
|
7.0 | mcr.microsoft.com/dotnet/aspnet:7.0 | Debian GNU/Linux 11 (bullseye) |
|
8.0 | mcr.microsoft.com/dotnet/aspnet:8.0 | Debian GNU/Linux 12 (bookworm) |
|