PHP settings

You can choose which version of PHP to run in your .magento.app.yaml file:

name: mymagento
type: php:<version>
TIP
If upgrading to PHP 8.1 and later, remove JSON from the runtime: extensions: property in the .magento.app.yaml file and redeploy. The JSON extension comes installed in Cloud environment since PHP 8.0.

Configure PHP

You can customize the PHP settings for your environment using a php.ini file that is appended to the configuration maintained by Adobe Commerce.

In your repository, add the php.ini file to the root of the application (the repository root).

TIP
Configuring PHP settings improperly can cause issues, so only advanced administrators should set these options.

Increase PHP memory limit

To increase the PHP memory limit, add the following setting to the php.ini file:

memory_limit = 1G

For debugging, increase the value to 2G.

Optimize realpath_cache configuration

Set the following realpath_cache settings to improve application performance.

;
; Increase realpath cache size
;
realpath_cache_size = 10M

;
; Increase realpath cache ttl
;
realpath_cache_ttl = 7200

These settings allow PHP processes to cache paths to files instead of looking them up for each page load. See Performance Tuning in the PHP documentation.

NOTE
For a list of recommended PHP configuration settings, see Required PHP settings in the Installation guide.

Check custom PHP settings

After pushing the php.ini changes to your Cloud environment, you can check that the custom PHP configuration has been added to your environment. For example, use SSH to log in to the remote environment and view the file using something similar to the following:

cat /etc/php/<php-version>/fpm/php.ini
WARNING
If you use Cloud Docker for Commerce for local development, see Docker service containers for information about using a custom php.ini file in a Docker environment.

Enable extensions

You can enable or disable PHP extensions in the runtime:extension section. Also, the extensions specified become available in the Docker PHP containers.

IMPORTANT
Before enabling extensions, it is important to understand that the PHP version must be compatible with the operating system hosting the project. Your project environment might require an OS upgrade by the Infrastructure team before you can proceed.

Example in .magento.app.yaml file:

runtime:
    extensions:
        - sockets
        - sodium
        - ssh2
    disabled_extensions:
        - bcmath
        - bz2
        - calendar
        - exif

Use SSH to log in to an environment and list the PHP extensions.

php -m

For details about a specific PHP extension, see the PHP Extension List.

The following table shows the supported PHP extensions when deploying Adobe Commerce on the Cloud platform.

Default extensions
Installed extensions that cannot be uninstalled
Extensions that can be installed and uninstalled as needed
bcmath
bz2
calendar
exif
gd
gettext
intl
libxml
mysqli
opcache
pcntl
pdo_mysql
Reflection
soap
sockets
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
zip
zlib
ctype
curl
date
dba
dom
fileinfo
filter
ftp
hash
iconv
json
mbstring
mysqlnd
openssl
pcre
pdo
pdo_sqlite
phar
posix
readline
session
sqlite3
tokenizer
xml
xmlreader
xmlwriter
geoip
gmp
igbinary
imagick
imap
ldap
mailparse
mcrypt
msgpack
mysqli
oauth
pdo_mysql
propro
pspell
raphf
recode
redis
shmop sockets
sodium
ssh2
tidy
xdebug
xmlrpc
xsl
yaml

PHP module requirements are tied to the Adobe Commerce version. See PHP requirements.

Extension support

For Pro projects, the following extensions require additional support to install:

  • ioncube
  • sourceguardian

For example, to set up PHP to execute only SourceGuardian-protected scripts in all environments, the following option must be set in the php.ini file:

[SourceGuardian]
sourceguardian.restrict_unencoded = "1"

See section 3.5 of the SourceGuardian documentation. This is a link to a PDF.

Submit an Adobe Commerce Support ticket for help with installing these PHP extensions in all Production environments and Pro Staging environments. Include your updated .magento/services.yaml file, .magento.app.yaml file with the updated PHP version and any additional PHP extensions. For changes to a live Production environment, you must provide a minimum of 48 hours notice. It can take up to 48 hours for the Cloud infrastructure team to update your project.

WARNING
PHP compiled with debug is not supported and the Probe may conflict with XDebug or XHProf. Disable those extensions when enabling the Probe. The Probe conflicts with some PHP extensions like Pinba or IonCube.
recommendation-more-help
05f2f56e-ac5d-4931-8cdb-764e60e16f26