php

If you have not installed PHP with the build system, these commands will not work. To install PHP run this command and select the PHP version with the highest version number:

sw build install php-8.2

By default, only currently supported versions of PHP are available to install. If you need to install or run updates for a version of PHP that is no longer supported, run this command to get access to those versions:

sw setting set enable_php_legacy_versions True

Similarly, if you want to enable installing pre-release versions of PHP, run this command prior to running the install command:

sw setting set enable_php_prerelease_version True

After changing php version settings, you may need to clear the cache of known PHP versions by running this command:

rm /opt/sitewrangler/var/cache/php-versions

list

sw php list
sw php list disabled

List PHP sites along with PHP versions and system usernames.

add

sw php add
sw php create
sw php add example.com
sw php add example.com unix_user
sw php add example.com unix_user 8.2

Create a PHP-FPM vhost file for a new site. This should almost always be called after ‘sw nginx add example.com unix_user’.

change

sw php change
sw php change example.com
sw php change example.com 8.2

Change the PHP version a site is using. This restarts PHP services to reflect the change.

disable

sw php disable
sw php disable example.com

Disable a PHP vhost.

enable

sw php enable
sw php enable example.com

Enable a disabled PHP vhost.

edit

sw php edit
sw php edit example.com

Edit a PHP vhost and restart the appropriate PHP version upon exit.

remove

sw php remove
sw php delete
sw php remove example.com

Delete a PHP vhost.

status

sw php status

Get the service status output for all enabled PHP versions. Note that any version of PHP with no enabled sites will be in a failed state.