PHP versions and settings
PHP versions
The available PHP versions are determined by the server’s Ubuntu release.
Change an app’s PHP version
To change an app’s PHP version:
- Go to the Apps page in the dashboard and click on the name of the app.
- Click on Settings.
- For the PHP Version, click the edit icon and select the desired PHP version.
- Click on Update.
Change the version of the php command
The PHP version of the php command is configured server-wide.
The version is not associated with the PHP version of a specific app on the server.
To determine the current PHP version for the PHP CLI, run the command:
php -vTo change the PHP version of the php command:
- SSH into your server as the user
root. - Run the command:
Terminal window sudo dpkg-reconfigure sp-php-cli - Select the desired PHP version and press Enter.
PHP settings
PHP settings control the behavior of PHP.
- Default settings for PHP 8.5
- Default settings for PHP 8.4
- Default settings for PHP 8.3
- Default settings for PHP 8.2
- Default settings for PHP 8.1
- Default settings for PHP 8.0
- Default settings for PHP 7.4
- Default settings for PHP 7.3
- Default settings for PHP 7.2
Change settings
PHP settings can be changed either per-app or server-wide.
View settings with phpinfo()
To view the current PHP settings for an app, create a PHP script
in the app’s public/ directory that contains the following:
<?php phpinfo(); ?>Request the file through your browser to view the app’s current PHP settings.
The output of phpinfo() shows two values for each setting:
- The “Local value” column shows the current PHP settings for your app
including any settings configured using a
.user.inifile. - The “Master Value” column shows the default PHP settings including any customizations to default PHP settings.
View settings with the CLI
To view PHP settings using the PHP CLI, use the -i flag:
php -iThe output of php -i shows the server-wide settings for the
PHP version of the php command.
By default, the PHP CLI will not read .user.ini files.
To force the PHP CLI to read .user.ini files, set the
PHP_INI_SCAN_DIR environment variable.
For example:
PHP_INI_SCAN_DIR=apps/APPNAME/public php -iWhen using the PHP_INI_SCAN_DIR environment variable to include
settings from .user.ini files, the values from the .user.ini
files will be shown as both the “Local value” and the “Master Value”.
PHP extensions
In addition to official extensions that are part of PHP, you can install third-party PHP extensions.
Default extensions
See the default extensions for each PHP version.
Install third-party extensions
Install third-party extensions to add functionality to PHP.
PHP CLI
The PHP version for the php, composer, and wp commands is determined
by the version of the PHP CLI that is configured server-wide.
To use multiple versions of the php, composer, and wp commands
without changing the default version of the PHP CLI,
versioned commands are available.
Versioned php commands
In addition to the php command, versioned commands are available.
php8.5-spphp8.4-spphp8.3-spphp8.2-spphp8.1-spphp8.0-spphp7.4-spphp7.3-spphp7.2-spphp7.1-spphp7.0-spphp5.6-spVersioned composer commands
In addition to the composer command, versioned commands are available.
composer8.5-spcomposer8.4-spcomposer8.3-spcomposer8.2-spcomposer8.1-spcomposer8.0-spcomposer7.4-spcomposer7.3-spcomposer7.2-spcomposer7.1-spcomposer7.0-spcomposer5.6-spVersioned wp commands
In addition to the wp command, versioned commands are available.
wp8.5-spwp8.4-spwp8.3-spwp8.2-spwp8.1-spwp8.0-spwp7.4-spwp7.3-spwp7.2-spwp7.1-spwp7.0-spwp5.6-sp