How to change the configuration of PHP? Print

  • 30

To change the settings of your PHP configuration you have two possibilities depending on your configuration. To determine which method to use you must connect to your Control Panel:

  1. In the"SOFTWARE" tab, click on the"Select a PHP version" icon;
  2. Once in the"PHP Selector", you will see the version and the mode currently activated under"Current PHP version" :
    • If you have a"native (X.Y)" version, which is the default configuration if you did not change this setting voluntarily, you will have to use a .htaccess file for each of your sites to configure;
    • If you have selected another version (non-native), you can use the"PHP Selector" interface of your control panel to be able to modify the PHP configuration for all your sites at the same time; or always use a .htaccess file for each specific configuration to be applied.

.htaccess file

To modify a PHP setting via an .htaccess file, you must create or modify a file named .htaccess in the root of your site or in each folder containing your relevant PHP scripts. The configuration is valid for the folder where the file is located as well as all its subfolders, unless another .htaccess file is located there.

This file must contain all the PHP parameters that you want to modify. Here is a list of the most commonly modified parameters, with their default values:

  • php_flag allow_url_fopen On
  • php_flag display_errors Off
  • php_value error_reporting E_ALL
  • php_flag file_uploads On
  • php_flag log_errors On
  • php_value max_execution_time 360
  • php_value max_input_time 120
  • php_value max_input_vars 200000
  • php_value memory_limit 512M
  • php_value post_max_size 128M
  • php_flag short_open_tag On
  • php_value upload_max_filesize 512M
  • php_value session.gc_maxlifetime 1440
  • php_flag zlib.output_compression Off

Note that the "php_flag" directive is used to assign a boolean value (On/Off) and "php_value" used for any other value.

Selected version (non-native)

If you have selected another version than the native one, the .htaccess files will always have a priority on your PHP configuration. The settings you enter via the interface provided in your control panel will be valid for all your sites hosted in your account and for the settings not defined in your .htaccess files. To do this, once connected to your :

  1. In the"SOFTWARE" tab, click on the"Select a PHP version" icon;
  2. Once in the"PHP Selector", right click on"Switch To PHP Options" and you will see the list of modifiable parameters;
  3. Click on the value of the parameter you want to change and select the new value that suits you best;
  4. Click on the "Apply" button that appears to the right of the value to validate your choice;
  5. Don't forget to click on"Save" at the bottom of the list so that your new configuration is applied.

Was this answer helpful?