PHP Configuration - php.ini

From Acenet Knowledgebase
(Redirected from How to configure PHP)
Jump to: navigation, search

Acenet uses CloudLinux with PHP Selector to allow you to select from several different versions of PHP. This is useful if you want to run a PHP application requiring a different release of PHP than the default version on the server.

If you are on a Cloud or Dedicated server without PHP selector, the instructions can be found here

Shared Hosting and Dedicated servers with PHP Selector

1) Log into your cPanel as normal.

2) Scroll down to the "Software/Services" section and click on "Select PHP Version".

3) Choose the php version you need from the "PHP version" dropdown menu.

4) A list of available php extensions for that version of PHP will appear underneath. The most commonly needed modules will already be selected, but if you have specific modules that you know your software needs, you can enable them as well by selecting their checkboxes and clicking on the "SAVE" button underneath.


5) Once your php version is selected and any changes to the selected modules are saved, click on the "Set as current" button next to the PHP version dropdown menu.

Changing your php.ini settings

1) Log into your cPanel as normal.

2) Scroll down to the "Software/Services" section and click on "Select PHP Version".

3) If the "PHP Version" is set to Native, Choose the php version you need from the "PHP version" dropdown menu and then click "Set as Current".

4) click on the Show PHP Settings button in the upper right of the selector screen.


5) This shows the most commonly edited account-wide PHP settings. Click on the grey value to the right, and you will either see a dialog field or a drop down box. Make the changes as needed, and then click apply. When done, click the save button at the bottom.

If there are any php.ini settings that are not listed, please open a support ticket and request that it be added to the default alt-php config.

That's it! Your account is now set to use the version of php that you chose.

Cloud/Dedicated Servers without PHP Selector

You can customize a php configuration using a php.ini file to modify php configurations for your script. You can change any of the PHP settings that are configured on the server by using a custom php.ini file. All you need to do is create a text document entitled php.ini in the needed directory.

Within this text document, specify the setting(s) you're wanting to change on separate lines. Here are some examples of PHP settings that you can change:

register_globals = Off
memory_limit = 64M

You will then need to set the permissions of the file to '755' and place it within the executing script's directory (the same directory that your script is located that requires this setting) because php.ini files are not recursive. If you're wanting to make your custom php.ini file recursive, in which it will affect all of your account's web accessible directories, you can view details on how to do so here:

You can verify that the settings you specified have taken effect by creating a text document entitled:


with the following specified within it:

<? phpinfo(); ?>

You will then upload the 'phpinfo.php' file to the same directory you uploaded the 'php.ini' file to and view the 'phpinfo.php' file in your internet browser.

Make php.ini apply to subdirectories

You will want to be careful when using a recursive php.ini file though because it will affect all of the scripts installed within your account. A recursive php.ini file may even cause some of your scripts to break if they need settings configured differently than what you have specified in your recursive php.ini file.

Add the following code to the .htaccess file within your account's public_html folder (if one does not already exist, create one):

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USERNAME/PATH/TO/INI/

(replacing '/home/USERNAME/PATH/TO/INI/' with the appropriate path to your custom php.ini file)

Properly configured example:

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/example/public_html/shop/

In the above example, the custom php.ini file is located at:


and that php.ini file is now recursive which means it will effect all of the web accessible directories within the account and not just the directory it's located in.