How To: Set Allowed PHP File Extensions Globally ================================================ While .php is the most common extension for modern PHP websites, in some cases, websites may be coded to use non-standard extensions such as .phtml or .php3. Setting these options globally can only be completed by a server administrator. Information on how to set allowed PHP file extensions for a single domain via SiteWorx can be found :doc:`here `. .. warning:: Setting these options globally is not recommended, as it could lead to lower overall security on the server. Best practices would dictate that System Administrators only allow additional PHP file extensions when absolutely required by a domain. Please proceed with caution. .. contents:: To Set Allowed PHP File Extensions Globally ------------------------------------------- #. Log in to the server at the CLI as root, either via SSH or from the terminal #. At the CLI, use the following command to set the ``FPM_LIMIT_EXTENSIONS`` configuration, replacing each ``{.ext}`` with a desired file extension, separated by spaces. Make sure the period is included: .. code-block:: ~iworx/bin/config.pex --set --name FPM_LIMIT_EXTENSIONS --global --value "{.ext} {.ext} {.ext}" Example, using ``.php .phar .html``: .. code-block:: ~iworx/bin/config.pex --set --name FPM_LIMIT_EXTENSIONS --global --value ".php .phar .html" The current configuration can be seen with the following command: .. code-block:: ~iworx/bin/config.pex --get --name FPM_LIMIT_EXTENSIONS --global Example: .. code-block:: [root@interworx ~]# ~iworx/bin/config.pex --get --name FPM_LIMIT_EXTENSIONS --global .phar .php .html [root@interworx ~]# #. At the CLI, use the following command to set the ``HTTPD_PHP_FILES_MATCH`` configuration, replacing each ``{ext}`` with a desired file extension. Each extension should be separated by a ``|`` character. Periods should **not** be included: .. code-block:: ~iworx/bin/config.pex --set --name HTTPD_PHP_FILES_MATCH --global --value "{ext}|{ext}|{ext}" Example, using ``php|phar|html``: .. code-block:: ~iworx/bin/config.pex --set --name HTTPD_PHP_FILES_MATCH --global --value "php|phar|html" The current configuration can be seen with the following command: .. code-block:: ~iworx/bin/config.pex --get --name HTTPD_PHP_FILES_MATCH --global Example: .. code-block:: [root@interworx ~]# ~iworx/bin/config.pex --get --name HTTPD_PHP_FILES_MATCH --global php|phar|html [root@interworx ~]# #. At the CLI, use the following command to set the ``HTTPD_PHP_EXTENSION_LIST`` configuration, replacing each ``{.ext}`` with a desired file extension, separated by spaces. Make sure the period is included: .. code-block:: ~iworx/bin/config.pex --set --name HTTPD_PHP_EXTENSION_LIST --global --value "{.ext} {.ext} {.ext}" Example, using ``.phar .php .html``: .. code-block:: ~iworx/bin/config.pex --set --name HTTPD_PHP_EXTENSION_LIST --global --value ".phar .php .html" The current configuration can be seen with the following command: .. code-block:: ~iworx/bin/config.pex --get --name HTTPD_PHP_EXTENSION_LIST --global Example: .. code-block:: [root@interworx ~]# ~iworx/bin/config.pex --get --name HTTPD_PHP_EXTENSION_LIST --global .phar .php .html [root@interworx ~]# #. At the CLI, use the following commands to rewrite all vhosts and php-fpm pools: .. code-block:: ~iworx/bin/httpd.pex --write-vhosts-all ~iworx/bin/php-fpm.pex --write-files --restart-fpm