Scripts ending in .php will be executed with php-cgi.

Changing PHP options

Many PHP configurable options can be set by setting their values in a .user.ini file located in the directory where you want things changed. From the PHP Manual's list of php.ini directives, you can change any listed where the "Changeable" column says either "PHP_INI_PERDIR" or "PHP_INI_ALL". For example, your .user.ini might contain:

upload_max_filesize = “30M”

Choosing a version of PHP

You can choose among multiple versions of PHP:

PHP version Command-line path Sunset Date
7.3 /opt/remi/php73/root/usr/bin/php December 6, 2021
7.4 (default) /opt/remi/php74/root/usr/bin/php November 28, 2022
8.0 /opt/remi/php80/root/usr/bin/php November 26, 2023
8.1 /opt/remi/php81/root/usr/bin/php November 25, 2024

Warning

PHP 7.3 will be removed on December 17, 2021. Sites configured for PHP 7.3 will begin using the default release (currently 7.4, soon to be 8.0) at that time.

If you need to switch PHP versions, you can do so by creating or editing your site's .silk.ini file (for example ~/www-root/.silk.ini) and adding the version to the [php] section:

[php]
version = 8.1

Valid version choices are default, any of the versions listed in the table above, or newest (which provides the newest available on the system).

Your PHP processes should restart with any version changes within a few minutes. If you would like changes to take effect immediately, type pkill -u <myusername> php-cgi.

PHP versions from the command-line and scheduled tasks

Since multiple version of PHP are available, make sure you call the intended version. The version of PHP you call by default from the command-line should be the version specified in your ~/www-root/.silk.ini file. To call another version, or to call the correct one from a scheduled task, use its full path, listed in the table above.

Upgrading from PHP 7.3

You can test or permanently change your site to use a different PHP version whenever convenient. Check your error log file for new warnings and errors after updating PHP.

PEAR is no longer included with PHP. Add-on libraries should instead be configured using Composer.

A complete list of changes can be found in the PHP documentation at Migrating from PHP 7.3.x to PHP 7.4.x. In particular, note the list of backward incompatible changes.

Upgrading from PHP 7.4

As a major (x.0) release, PHP 8.0 introduces a number of new features while removing previously deprecated features and fixing existing undesirable behavior. Migrating to PHP 8.0 might require more testing for existing code than minor (x.y) releases.

You can test or permanently change your site to use a different PHP version whenever convenient. Check your error log file for new warnings and errors after updating PHP.

A complete list of changes can be found in the PHP documentation at Migrating from PHP 7.4.x to PHP 8.0.x. In particular, note the list of backward incompatible changes.

Upgrading from PHP 8.0

You can test or permanently change your site to use a different PHP version whenever convenient. Check your error log file for new warnings and errors after updating PHP.

A complete list of changes can be found in the PHP documentation at Migrating from PHP 8.0.x to PHP 8.1.x. In particular, note the list of backward incompatible changes.

Packages

Composer is a popular library dependency manager for PHP. Once you declare what packages your project needs, Composer can install them and keep them up to date. You can see what packages are available at Packagist.

A recent version of composer is available in your PATH.