Scripts ending in
.php will be executed with
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
PHP 5.3 will be retired on May 24, 2019.
On May 24, 2019, sites using PHP 5.3 will be moved to PHP 5.5. Breaking changes might occur at this time, and you should test and update your site prior to this date.
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|
|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|
If you need to switch PHP versions, you can do so by creating or editing your
.silk.ini file (for example
~/www-root/.silk.ini) and adding the
version to the
[php] version = 7.3
Valid version choices are
default, any of the versions listed in the table
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 5.3
PHP 5.3 support will end on May 24, 2019. Sites should be updated prior to this date to ensure compatibility when moved to PHP 5.5. You can test or permanently change your site to use a different PHP version whenever convenient before this date.
Some changes of note when updating PHP to a newer version:
mysqldatabase library no longer supports the original form of MySQL authentication. You will need to update your WebDB accounts to use modern authentication, reset their password, and update your site with the new password. Note that other sites using the same WebDB accounts will stop working if you do this unless also updated. If you need temporary additional credentials during migration in order to support old and modern authentication simultaneously, contact SAA for assistance.
- Magic quotes are no longer supported.
- Other updates might be required. Check your error log file for new warnings and errors after updating PHP.
For a complete list of changes between PHP 5.3 and 5.5, check out Migrating from PHP 5.3.x to PHP 5.4.x and Migrating from PHP 5.4.x to PHP 5.5.x in the PHP documentation. In particular, note the list of backward incompatible changes.
Upgrading from PHP 5.5
You can test or permanently change your site to use a different PHP version whenever convenient.
Database code changes might be necessary, as PHP's original MySQL
mysql) has been retired:
- Software whose database connection settings differentiate between
pdowill need its settings updated to either of the latter two choices.
- Custom database code will need to be rewritten. We suggest migrating to PDO,
which feels similar to
mysqlbut is more powerful. You can find a good overview in the article Migrate from the MySQL Extension to PDO, and a helpful cheat sheet at Mapping Obsolete MySQL Functions to Current PHP Extensions. See Web Publishing with WebDB for information specific to WebDB.
Other updates might be required. Check your error log file for new warnings and errors after updating PHP.
For a complete list of changes between PHP 5.5 and 7.2, check the following:
- Migrating from PHP 5.5.x to PHP 5.6.x
- Migrating from PHP 5.6.x to PHP 7.0.x
- Migrating from PHP 7.0.x to PHP 7.1.x
- Migrating from PHP 7.1.x to PHP 7.2.x
In particular, note the list of backward incompatible changes.
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.
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 config-create ~/ ~/.pearrc
After this, you can manage all your own PEAR modules with the
pear command. For example:
pear install MDB2