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

Changing PHP options

Many PHP configurable options can be set by placing a .user.ini file in the directory where you want things changed. See the PHP Manual for more information.

Choosing a version of PHP

You can choose among multiple versions of PHP, depending on which silk platform version your account is hosted on:

Silk platform PHP version Command-line path Sunset Date
silkv1 5.31 /usr/bin/php May 24, 2019
silkv1 5.51 /opt/rh/php55/root/usr/bin/php December 2019
silkv2 5.51 /opt/rh/php55/root/usr/bin/php December 2019
silkv2 7.2 (default) /opt/remi/php72/root/usr/bin/php November 30, 2020
silkv2 7.3 /opt/remi/php73/root/usr/bin/php December 6, 2021

  1. These old versions are discouraged but supported by the operating system vendor. 

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:

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

Composer Packages

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

PEAR Packages

You may need to use the older PEAR package manager to obtain PHP extensions for your application. If so, you'll need to initialize and maintain your own PEAR repository, and refer to it from within your application.

You can create your own local PEAR repository in ~/pear with:

pear config-create ~/ ~/.pearrc

After this, you can manage all your own PEAR modules with the pear command. For example:

pear install MDB2