Configuring php.ini

From Hostek.com Wiki
Revision as of 01:15, 3 January 2013 by Maxm (Talk | contribs) (Created page with "__FORCETOC__ ==Configuring server-wide php.ini settings== If you need to make adjustments to the php.ini file server-wide (affecting all sites on the VPS) then you could do th...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Configuring server-wide php.ini settings

If you need to make adjustments to the php.ini file server-wide (affecting all sites on the VPS) then you could do this by logging into cPanel/WHM as root and clicking on the "PHP Configuration Editor".

Creating a custom php.ini file

Do not just create a blank php.ini file and add the settings you need. Doing this will ignore all of the other PHP configuration that was setup by the server such as extensions and modules. Be sure to copy the server's php.ini file and make the customizations in that file by following these steps.

If you need to make changes to php.ini for a specific site only follow these steps:

  1. SSH into the server
  2. Copy the server's php.ini file to the the site's public_html directory by running this command:
    cp /usr/local/lib/php.ini /home/username/public_html/
    *Replace username with the username of the site
  3. Edit the php.ini with your favorite text editor. For example:
    nano /home/username/public_html/php.ini
    and make the desired changes.
  4. Add the following to the /home/username/public_html/.htaccess file (create one if you don't have one):
     SetEnv PHPRC /home/username/public_html/php.ini
    *use the real path for your site