Knowledgebase

PHP Selector's Useful Commands (Change PHP Versions/Extensions for all users, etc.)

PHP Selector is a feature commonly found in web hosting control panels like cPanel, Plesk, and others. It allows users to choose the version of PHP they want to use for their websites and also enables them to manage PHP extensions. Here are some useful commands and tasks you can perform with PHP Selector:

  1. Change PHP Version:

    css

 

  • selectorctl set php --version=<version> --user=<username>

    Replace <version> with the desired PHP version (e.g., 7.2, 7.3, etc.) and <username> with the actual username.

  • List Available PHP Versions:

    css
  • selectorctl --list

    This command will display a list of available PHP versions.

  • Enable/Disable PHP Extensions:

    css
  • selectorctl set php --extension=<extension> --status=on --user=<username> selectorctl set php --extension=<extension> --status=off --user=<username>

    Replace <extension> with the extension name (e.g., pdo, gd, mysqli, etc.) and <username> with the actual username.

  • List Installed PHP Extensions:

    css
  • selectorctl --show-extensions

    This command will display a list of installed PHP extensions.

  • Set PHP Options:

    css
  • selectorctl set php --options=<option_name> --value=<value> --user=<username>

    Replace <option_name> with the PHP option you want to set (e.g., memory_limit, max_execution_time, etc.) and <value> with the desired value.

  • List PHP Options:

    css
  • selectorctl --show-options

    This command will display a list of available PHP options.

  • Reset PHP Configuration to Default:

    css
  • selectorctl reset php --user=<username>

    This command will reset PHP configuration options for the specified user to their default values.

  • Apply PHP Configuration System-Wide:

    csharp

 

  1. selectorctl set global --version=<version> --extension=<extension> --status=on

    This command will apply a specific PHP version or extension to all users.

Remember to replace <version>, <extension>, and <username> with the actual values. Always exercise caution when using these commands, especially when making system-wide changes, as they can affect all users on the server. It's recommended to have backups and test changes in a controlled environment before applying them to a production server.

  • 0 Users Found This Useful
Was this answer helpful?