- Overview
- Available PHP Versions
- How to Update PHP
- Fix MultiPHP Error
- php.ini
- Limits
- View Settings
The php.ini file is a special file for PHP. It is where you declare changes to your PHP settings. The server is already configured with standard settings for PHP, which your site will use by default. Unless you need to change one or more settings, there is no need to create or modify a php.ini file. If you would like to make any changes to settings, please do so through the MultiPHP INI Editor.
- How To Modify PHP Settings
- How To Create a New php.ini File
How To Modify PHP Settings via the MultiPHP INI Editor
There may be times where you need to change some of the default PHP settings, and below we've outlined those steps. However, keep in mind that there are PHP Settings That Cannot Be Changed on our Shared, Cloud, & Reseller hosting.
To modify the PHP settings:
- Log in to cPanel.
- In the Software section, click on the MultiPHP INI Editor icon.
- On the MultiPHP INI Editor page, select Home Directory or the specific domain you wish to update from the Configure PHP INI basic settings dropdown.
- Select the new setting for each
PHP directive you would like to change.
- Click Apply at the bottom to save your changes.
How to Create a New php.ini File
Important Note: HostGator won't know why you want or need to change these settings. You would change this at the advice of your web designer or the developer of your script. HostGator can only show you where to make the change.
- For Plesk users, the file should already exist in the directory /var/www/vhost/$DOMAIN/etc/php.ini.
- For the cPanel, this file should be created in your Home directory (/home/username/).
The username is your actual cPanel username, and $DOMAIN is your actual domain.
To create a new php.ini file in your cPanel:
- In the
Files section of your cPanel, click on the File Manager icon.
- Select the root directory for your site. The default for the primary is public_html.
- Click the + File button at the top left of the page.
- In the pop-up box, enter php.ini in the New File Name field. Make sure the root directory is in the bottom box.
- Click Create New File.
- Locate and right-click the new php.ini file and select Edit, then click the Edit button again.
- You can now input the contents of your php.ini file. Click Save to save your changes.
Some hosting accounts use the PHP Selector instead of php.ini files to configure PHP settings. However, you can still specify custom PHP settings for a directory by using .user.ini files. This article explains how to set up and use .user.ini files on your account.
Using .user.ini files
When you create a .user.ini file, any PHP directives in the file are only active in that directory (and any subdirectories beneath it). This enables you to have different PHP settings for different directories. This may be necessary, for example, if you install two applications on your account that have different PHP requirements.
To enable custom settings in a .user.ini file, follow these steps:
- Use your preferred
text editor to create a .user.ini file in the directory where you want to enable custom PHP settings.
Make sure you include the leading period at the start of the filename: .user.ini
- In the .user.ini file, add the setting (or settings) that you want active in the directory. For example, to activate error reporting for scripts in the directory, add the following directive: display_errors=On
- Save your changes to the .user.ini file. The new settings take effect immediately.
More Information
To view the official PHP documentation, please visit //www.php.net/docs.php.