Copy PHP.ini from another cPanel Account

Date: December 2, 2019     2 Minutes to Read

In this article:

Sometimes, when you only need to add a few changes, it’s easy to simply create a php.ini file with only the needed adjustments. However, for improved overall workflow you’d benefit from a complete php.ini file.

If changing your PHP version in cPanel from and back to the preferred option doesn’t work, and you don’t have MultiPHP INI Editor installed, you can copy a full php.ini file from another cPanel account or directly from the server.

Copy From the Server Default

  1. SSH into the cPanel account without a php.ini file.
  2. Type the command below, replacing public_html with the file path to the website without a php.ini file as needed and php56 with the applicable PHP version – i.e. 70 for 7.0.
    For VPS users:

     

    cp /opt/cpanel/ea-php56/root/etc/php.ini ~/public_html/

    Shared users must use the following:

    cp /usr/local/lib/php.ini ~/public_html/

Copy From Another Account

VPS users with root access can copy the php.ini file between cPanel accounts using SSH

  1. SSH into your VPS as user root.
  2. Type the command below, replacing public_html with the file path to the website without a php.ini file as needed and php56 with the applicable PHP version – i.e. 70 for 7.0.
    cp /home/user2/public_html/php.ini /home/user1/public_html/php.ini

    Replace user2 with the cPanel user with a php.ini file and user1 with the cPanel user needing one.

Copy Using cPanel or FTP

    1. Download the php.ini file from the appropriate cPanel account using cPanel File Manager or FTP andupload it to the cPanel account for the appropriate cPanel account.
  • Alternatively, you can obtain a php.ini file from our What is your default php.ini file guide. You can then edit your new php.ini file and check your PHP settings with a phpinfo.php file. You may also want to make the file recursive to apply to child folders.

    InMotion Hosting Contributor
    InMotion Hosting Contributor Content Writer

    InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

    More Articles by InMotion Hosting

    Was this article helpful? Join the conversation!