How to: Set Individual/Per-Domain ini Configurations for Custom PHP Options
===========================================================================
Custom configurations for PHP settings can be added to domains by creating custom ini files. The type of file and process
differs, depending on if the server's PHP mode is SuPHP or PHP-FPM.
The server's PHP mode can be found on the Webserver page in NodeWorx. PHP-FPM is the default for all new installations
of InterWorx. SiteWorx users will need to contact their hosting providers for this information.
.. contents::
To Create a Custom ini file for SuPHP
-------------------------------------
Custom ini files for SuPHP are named ``php.ini``, and must be located at ``/home/{unixuser}/etc/php.ini``. A ``.htaccess`` edit
is also required.
.. note::
It is not possible to create a custom ini file from within the SiteWorx interface--it must be created via the CLI.
SiteWorx users who do not have shell access should contact their hosting provider.
#. Log in to the server at the CLI as root, either via SSH or from the terminal
#. From the CLI, create a directory named ``/home/{unixuser}/etc``, replacing ``unixuser`` with the user associated with
the SiteWorx account
.. code-block::
mkdir /home/unixuser/etc
#. Copy the default ``php.ini`` file (usually found in ``/etc/``) to a new file named ``/home/{unixuser}/etc/php.ini``
.. code-block::
cp /etc/php.ini /home/unixuser/etc/php.ini
#. Make sure the new directory and file are both owned by the unixuser
.. code-block::
chown unixuser:unixuser /home/unixuser/etc
chown unixuser:unixuser /home/unixuser/etc/php.ini
#. Using a text editor, add the desired custom PHP settings
#. Save and write the file
#. Exit the text editor
#. Using a text editor, either create a new ``.htaccess`` file under ``/home/unixuser/public_html``, or open an existing
``.htaccess`` file for editing
#. Add the following entry, replacing ``unixuser`` with the user associated with the SiteWorx account
.. code-block::
suPHP_ConfigPath /home/{unixuser}/etc/
order allow,deny
deny from all
#. Save and write the file
#. Exit the text editor
To Create the Custom ini File For PHP-FPM
-----------------------------------------
Custom ini files for PHP-FPM users (which includes PHP versions included in the Multiple PHP Tool) are named ``.user.ini``
and must be located at ``/home/{unixuser}/domain.com/html/.user.ini`` or ``/home/{unixuser}/public_html/.user.ini``.
Changes to php-fpm settings are a bit limited, in comparison to custom options for SuPHP. More information is
available `here `__.
.. note::
It is not possible to create a custom ini file from within the SiteWorx interface--it must be created via the CLI.
SiteWorx users who do not have shell access should contact their hosting provider.
#. Log in to the server at the CLI as root, either via SSH or from the terminal
#. From the CLI, navigate to ``/home/{unixuser}/{domain.com}/html`` (or ``/home/{unixuser}/public_html``), replacing
``unixuser`` and ``domain.com`` with the user and domain associated with the SiteWorx account
#. Using a text editor, create a file named ``.user.ini``
.. note::
The file must be literally named ``.user.ini``, not to be confused with the unixuser name.
#. Add the custom setting information. Example:
.. code-block::
[root@server html]# pwd
/home/iwtestco/iwtest.com/html
[root@server html]# cat .user.ini
max_file_uploads = 15
[root@server html]#
#. Save and write the file
#. Exit the text editor
#. Make sure that the file is owned by the unixuser
.. code-block::
chown unixuser:unixuser /home/unixuser/domain.com/html/.user.ini