HostICan - Shared Hosting

How do I find and copy a php.ini file?

Finding the location of your php.ini file and moving it to your account is sometimes a more
complicated process then it sounds. So we have aimed to simplify it for you, by creating this
tutorial. PLEASE NOTE: this tutorial is designed for apache running as CGI.

How to locate the php.ini file?

  • You will need to make a info.php file. How this can be done, can be found on: http://php.about.com/od/learnphp/p/PHP_info.htm
  • Once you have created and saved this page, you will need to upload it to your account via FTP, please make sure that you upload it into the /public_html/
  • Upon completion, you should be able to navigate to it by going to yourdomain.com/info.php

Where is the main php.ini located?

  • Upon the info.php page loading, you will need to search for "Loaded Configuration File" path.
  • Once you see this path, you will need to login to SSH (the info is located in your welcome email)

Making a copy of the primary php.ini [ADVANCED]:

  • For this section, you will need to know your cPanel username (you will need to replace the "CPANELUSERNAME" in the code located below), as it will be important!
  • Once your logged into SSH, you will need to run the following commands:

    # cp /usr/local/lib/php.ini /home/CPANELUSERNAME/public_html/

  • Upon running that command, you will need to resolve the ownership of the php.ini

    # cd /home/CPANELUSERNAME/public_html/
    # chown CPANELUSERNAME:CPANELUSERNAME php.ini

Congratulations, now you can make the changes to the php.ini and move it around anywhere in the /public_html/ folder to make the necessary changes for your websites configuration.

Related Articles
No related articles were found.