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.

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.

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. From the CLI, create a directory named /home/{unixuser}/etc, replacing unixuser with the user associated with the SiteWorx account

    mkdir /home/unixuser/etc
    
  3. Copy the default php.ini file (usually found in /etc/) to a new file named /home/{unixuser}/etc/php.ini

    cp /etc/php.ini /home/unixuser/etc/php.ini
    
  4. 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
    
  5. Using a text editor, add the desired custom PHP settings

  6. Save and write the file

  7. Exit the text editor

  8. Using a text editor, either create a new .htaccess file under /home/unixuser/public_html, or open an existing .htaccess file for editing

  9. Add the following entry, replacing unixuser with the user associated with the SiteWorx account

    suPHP_ConfigPath /home/{unixuser}/etc/
    <Files etc/php.ini>
    order allow,deny
    deny from all
    </Files>
    
  10. Save and write the file

  11. 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.

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. 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

  3. 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.

  4. 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]#
    
  5. Save and write the file

  6. Exit the text editor

  7. Make sure that the file is owned by the unixuser

    chown unixuser:unixuser /home/unixuser/domain.com/html/.user.ini