Silk Web Hosting: PHP

Modified

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

Changing 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

You can choose among multiple versions of PHP:

PHP version Command-line path Sunset Date
8.1 /opt/remi/php81/root/usr/bin/php November 25, 2024
8.2 (default) /opt/remi/php82/root/usr/bin/php December 8, 2025
8.3 /opt/remi/php83/root/usr/bin/php November 23, 2026

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.3

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 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.

Upgrading from PHP 8.1

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.1.x to PHP 8.2.x. In particular, note the list of backward incompatible changes.

Upgrading from PHP 8.2

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.2.x to PHP 8.3.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.