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, replacingunixuserwith the user associated with the SiteWorx accountmkdir /home/unixuser/etc
Copy the default
php.inifile (usually found in/etc/) to a new file named/home/{unixuser}/etc/php.inicp /etc/php.ini /home/unixuser/etc/php.ini
Make sure the new directory and file are both owned by the unixuser
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
.htaccessfile under/home/unixuser/public_html, or open an existing.htaccessfile for editingAdd the following entry, replacing
unixuserwith the user associated with the SiteWorx accountsuPHP_ConfigPath /home/{unixuser}/etc/ <Files etc/php.ini> order allow,deny deny from all </Files>
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), replacingunixuseranddomain.comwith the user and domain associated with the SiteWorx accountUsing a text editor, create a file named
.user.iniNote
The file must be literally named
.user.ini, not to be confused with the unixuser name.Add the custom setting information. Example:
[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
chown unixuser:unixuser /home/unixuser/domain.com/html/.user.ini