LoginLogin About

Support » Knowledge Base » General questions » Tips for scripts owners »

How to change a PHP parameter

Elimination of some technical issues may require modification of the PHP configuration. It can be achieved in two ways as described below:

  1. Change the value of the required parameter in configuration file php.ini. After editing the file save it and restart the web server for the changes to take effect. File php.ini, as a rule, can only be accessed by the server administrator. Users of virtual web hosting accounts are usually not allowed to edit that file.
  2. Override the value of the required parameter in a .htaccess file. Basic rules for editing .htaccess files are as follows:
    • if a parameter may only be assigned flag values On or Off (1 or 0), then add a directive of the following kind to file .htaccess:
      php_flag PARAMETER_NAME PARAMETER_VALUE

      Example:

      php_flag display_errors 1

      Examples of parameters which can be overridden using this syntax: display_errors, short_open_tags, log_errors.

    • in all other cases the overriding directive should look like shown below:
      php_value PARAMETER_NAME PARAMETER_VALUE

      Example:

      php_value memory_limit 64M

      Examples of parameters which can be overridden using this syntax: memory_limit, post_max_size, max_execution_time.

    Note: Overriding PHP configuration using .htaccess files may be restricted on your server. Such files are not processed by web server IIS, and Apache if PHP is used as a CGI. To change PHP parameters on such servers either edit file php.ini (if you have such privileges) or apply to your system administrator for assistance.