The PHP.INI file is a special PHP file that declares values of various settings in PHP. Each site uses the server default PHP.INI file. If a copy of this default PHP.INI is needed, such as to keep a local copy, it can be generated so that the default PHP.INI file can be accessed.
Related Articles
Update PHP INI Values
Using MultiPHP INI Editor in cPanel
Update PHP Version with MultiPHP Manager
SSH into Shared Server
How to SSH into VPS or Dedicated Servers
Creating and Locating the Default PHP.INI Using cPanel
- Log into cPanel
- Navigate to MultiPHP Manager, located in the Software section
- Select the appropriate domain(s)
- Choose the PHP version from the drop-down menu and click Apply
CAUTION: Choose the same PHP version as the site is currently set to. Changing the PHP version unintentionally to a different version may cause the site to stop working.
NOTE: Once the PHP version has been manually applied, the default PHP.INI file will be copied to the cPanel account's local files. - Navigate to the File Manager, in the Files section
- Navigate to the correct document root for the domain
- Locate the PHP.INI file
Creating the Default PHP.INI via Command Line
- SSH into the account
- As the cPanel user, navigate to the document root of the website that needs a PHP.INI file.
EXAMPLE: For the primary domain usecd public_html
- Run the following command to find the configuration file:
php --ini | grep "Loaded Configuration File"
EXAMPLE:
[imhkmc6@ecngx318 public_html]$ php --ini | grep "Loaded Configuration"
Loaded Configuration File: /opt/cpanel/ea-php74/root/etc/php.ini - Copy the loaded configuration file to the current directory using the
cp
command
cp <source_file> <destination_folder>
EXAMPLE: So, using the same example as above, for the configuration file to the current directory:
cp /opt/cpanel/ea-php74/root/etc/php.ini .
NOTE: Note the period at the very end. That tells the copy command (cp) to copy the file to the current directory. Make sure this is the root document of the website.
- The default PHP.INI file is now accessible from the document root, named
php.ini
Comments
0 comments
Please sign in to leave a comment.