---
title: Setting PHP parameters
description: On a VPS server, PHP runs in mod_php mode by default. You can also enable mod_cgi mode following this instruction. In mod_php mode, PHP runs as an Apache module. To configure PHP, changes are made to
---

[Skip to content](https://help.ishosting.com/en/setting-php-parameters#main-content)

- [English](https://help.ishosting.com/en/setting-php-parameters)
- [Русский](https://help.ishosting.com/ru/setting-php-parameters)

English

Show submenu for translations

[![is\*hosting](https://help.ishosting.com/hubfs/Logo_Ishosting_mono-1.svg)](https://help.ishosting.com/en)

- [Blog](https://blog.ishosting.com/en)
- [Support](https://my.ishosting.com/en/tickets)

Open main navigation

Close main navigation

- [Blog](https://blog.ishosting.com/en)
- [Support](https://my.ishosting.com/en/tickets)
- - [English](https://help.ishosting.com/en/setting-php-parameters)
    - [Русский](https://help.ishosting.com/ru/setting-php-parameters)

  English
  
  Show submenu for translations
- [Go to ishosting.com](https://ishosting.com/)

[Go to ishosting.com](https://ishosting.com/)

 Hello. How can we help you?

- There are no suggestions because the search field is empty.

1. [Help Center](https://help.ishosting.com/en)
2. [Server Administration](https://help.ishosting.com/en/server-administration)
3. [PHP](https://help.ishosting.com/en/server-administration#php)

# Setting PHP parameters

On a VPS server, PHP runs in mod\_php mode by default. You can also enable mod\_cgi mode following [this instruction](https://help.ishosting.com/en/php-connection-in-mod-cgi-mode).

In mod\_php mode, PHP runs as an Apache module. To configure PHP, changes are made to the .htaccess file.

In mod\_cgi mode, the php-cgi interpreter is launched. To configure PHP, changes are made to the .php.ini file in the site's cgi-bin directory.

### **Setting options in the .htaccess file**

All directives must be added at the beginning or at the end of the file. Do not add directives between \<IfModule\> ... \</IfModule\> code blocks.

#### apc.cache\_by\_default

apc improves performance through caching. It is also sometimes necessary to disable the apc accelerator, for example, when the cache is full.

To enable the apc accelerator run the command:

```
php_flag apc.cache_by_default on
```

To disable **apc** run the command:

```
php_flag apc.cache_by_default off
```

#### **default\_charset**

The default\_charset directive sets the default charset for all rendered pages. For example utf-8, cp1251, koi8-r.

To add a directive, enter:

```
AddDefaultCharset koi8-rphp_value default_charset koi8-r
```

#### **display\_errors**

The **display\_errors** directive allows you to hide or display errors.

To enable error output, enter:

```
php_value display_errors 1
```

To disable error output, enter:

```
php_value display_errors 0
```

#### **log\_errors**

The **log\_errors** directive enables php errors loging and saving to a user-defined file.

To enable the directive, enter:

```
php_value log_errors onphp_value error_log /home/u/user/path-to-file/errors.log
```

Where **user** is the username and **u** is the first letter of the username.

#### **magic\_quotes\_gpc**

The **magic\_quotes\_gpc** option enables escaping PHP script data. The backslash (\\), single quotes ('), and double quotes (") are automatically escaped.

To enable **magic\_quotes\_g**pc enter:

```
php_flag magic_quotes_gpc on
```

To disable **magic\_quotes\_gpc** enter:

```
 php_flag magic_quotes_gpc off
```

#### **mail.add\_x\_header**

The **mail.add\_x\_header** option enables logging of sending mail from site scripts. The logs contain the path to the script, recipient address and headers.

To **enable mail.add\_x\_header** enter:

```
php_value mail.add_x_header 1php_value mail.log /home/u/user/public_html/mail.log
```

Where **user** is the username and **u** is the first letter of the username.

#### **max\_input\_vars**

The **max\_input\_vars directive** sets the maximum number of input variables that can be accepted in one request.

For example, if the maximum number of input variables is 9000, enter:

```
php_value max_input_vars 9000
```

#### **mbstring.func\_overload, mbstring.internal\_encoding**

Usually the directives **mbstring.func\_overload** and **mbstring.internal\_encoding** are used to optimize the work of sites on CMS Bitrix. For this CMS enter:

```
php_value mbstring.func_overload 2php_value mbstring.internal_encoding UTF-8
```

For other CMS it is recommended to use the following values:

```
php_value mbstring.func_overload 0php_value mbstring.internal_encoding UTF-8
```

#### **opcache.revalidate\_freq**

The **opcache.revalidate\_freq** setting is required for CMS Bitrix. To disable the option enter:

```
php_value opcache.revalidate_freq 0
```

#### **pcre.recursion\_limit**

This directive allows you to set a limit on recursion.

```
php_value pcre.recursion_limit 12000
```

#### **post\_max\_size**

The **post\_max\_size** directive sets the maximum amount of data sent by the POST method:

```
php_value post_max_size 100M
```

To upload large files, **post\_max\_size** must be greater than **upload\_max\_filesize**.

#### **register\_globals**

The **register\_globals** directive is used to manage global variables.

To enable global variables, enter:

```
php_flag register_globals on
```

To disable global variables, enter:

```
 php_flag register_globals off
```

#### **request\_order**

The **request\_order** directive sets the order in which the Cookie, POST and GET variables are added to the \_REQUEST array:

```
 php_value request_order CPG
```

#### **upload\_max\_filesize**

This directive allows you to set the maximum size of the uploaded file.

```
php_value upload_max_filesize 100M
```

### Setting options in php.ini file

#### **allow\_url\_fopen**

The **allow\_url\_fopen** option enables URL wrappers (support for URL wrappers). This allows you to work with URL objects via ftp/http as with regular files.

To enable **allow\_url\_fopen** enter:

```
allow_url_fopen = 1
```

To disable **allow\_url\_fopen** enter:

```
 allow_url_fopen = 0
```

#### **apc.cache\_by\_default**

**apc** improves performance through caching. It is also sometimes necessary to disable the **apc** accelerator, for example, when the cache is full.

To enable the **apc** accelerator run the command:

```
apc.cache_by_default = 1
```

To disable **apc** run the command:

```
 apc.cache_by_default = 0
```

#### **default\_charset**

The **default\_charset directive** sets the default charset for all rendered pages. For example utf-8, cp1251, koi8-r.

To add a directive, enter:

```
default_charset = " koi8-r"
```

#### **display\_errors**

The **display\_errors** directive allows you to hide or display errors.

To enable error output, enter:

```
display_errors = on
```

To disable error output, enter:

```
 display_errors = off
```

#### **magic\_quotes\_gpc**

The **magic\_quotes\_gpc** option enables escaping PHP script data. The backslash (\\), single quotes ('), and double quotes (") are automatically escaped.

To enable **magic\_quotes\_g**pc enter:

```
magic_quotes_gpc = 1
```

To disable **magic\_quotes\_gpc** enter:

```
magic_quotes_gpc = 0
```

#### **mail.add\_x\_header**

The **mail.add\_x\_header** option enables logging of sending mail from site scripts. The logs contain the path to the script, recipient address and headers.

To **enable mail.add\_x\_header** enter:

```
mail.add_x_header = onmail.log = /home/u/user/public_html/mail.log
```

Where **user** is the username and **u** is the first letter of the username.

#### **max\_input\_vars**

The **max\_input\_vars directive** sets the maximum number of input variables that can be accepted in one request.

For example, if the maximum number of input variables is 9000, enter:

```
max_input_vars = 9000
```

#### **mbstring.func\_overload, mbstring.internal\_encoding**

Usually the directives **mbstring.func\_overload** and **mbstring.internal\_encoding** are used to optimize the work of sites on CMS Bitrix. For this CMS enter:

```
mbstring.internal_encoding = UTF-8mbstring.func_overload = 2
```

For other CMS it is recommended to use the following values:

```
mbstring.internal_encoding = UTF-8mbstring.func_overload = 0
```

#### **opcache.revalidate\_freq**

The **opcache.revalidate\_freq** setting is required for CMS Bitrix. To disable the option enter:

```
 opcache.revalidate_freq = 0
```

#### **pcre.recursion\_limit**

This directive allows you to set a limit on recursion.

```
 pcre.recursion_limit = 12000
```

#### **post\_max\_size**

The **post\_max\_size** directive sets the maximum amount of data sent by the POST method:

```
post_max_size = 100M
```

To upload large files, **post\_max\_size** must be greater than **upload\_max\_filesize**.

#### **register\_globals**

The **register\_globals** directive is used to manage global variables.

To enable global variables, enter:

```
register_globals = 1
```

To disable global variables, enter:

```
 register_globals = 0
```

#### **request\_order**

The **request\_order** directive sets the order in which the Cookie, POST and GET variables are added to the \_REQUEST array:

```
 request_order = CPG
```

#### **upload\_max\_filesize**

This directive allows you to set the maximum size of the uploaded file.

```
upload_max_filesize = 100M
```

#### Options that cannot be changed

When using a virtual server, the following php settings cannot be changed:

- apc.ttl
- apc.user\_entries\_hint
- memory\_limit
- apc.shm\_size
- apc.num\_files\_hint

#### View php parameters

To find out php parameters for a site, create an info.php file in its directory and add to it:

```
<?phpphpinfo();?>
```

Next, to view the details, follow the link http://your.website.name/info.php.

If you have any questions, please create a [ticket](https://ishosting.com/en/support) to technical support.

- [Virtual Private Servers](https://help.ishosting.com/en/virtual-private-servers#main-content)

    - [Getting Started](https://help.ishosting.com/en/virtual-private-servers#getting-started)
    - [Working with VPS](https://help.ishosting.com/en/virtual-private-servers#working-with-vps)
    - [Software](https://help.ishosting.com/en/virtual-private-servers#software)
    - [Backup and Data Storage](https://help.ishosting.com/en/virtual-private-servers#backup-and-data-storage)
    - [Additional Services](https://help.ishosting.com/en/virtual-private-servers#additional-services)
    - [VPS Load](https://help.ishosting.com/en/virtual-private-servers#vps-load)
    - [Other Issues](https://help.ishosting.com/en/virtual-private-servers#other-issues)
- [Dedicated Servers](https://help.ishosting.com/en/dedicated-servers#main-content)

    - [Getting Started](https://help.ishosting.com/en/dedicated-servers#getting-started)
    - [Working with Dedicated Server](https://help.ishosting.com/en/dedicated-servers#working-with-dedicated-server)
    - [Additional Services](https://help.ishosting.com/en/dedicated-servers#additional-services)
    - [Other Issues](https://help.ishosting.com/en/dedicated-servers#other-issues)
- [Server Administration](https://help.ishosting.com/en/server-administration#main-content)

    - [API](https://help.ishosting.com/en/server-administration#api)
    - [Windows Instructions](https://help.ishosting.com/en/server-administration#windows-instructions)
    - [UNIX Instructions](https://help.ishosting.com/en/server-administration#unix-instructions)
    - [ispmanager](https://help.ishosting.com/en/server-administration#ispmanager)
    - [VestaCP](https://help.ishosting.com/en/server-administration#vestacp)
    - [DirectAdmin](https://help.ishosting.com/en/server-administration#directadmin)
    - [BitrixVM](https://help.ishosting.com/en/server-administration#bitrixvm)
    - [Security](https://help.ishosting.com/en/server-administration#security)
    - [DDoS Protection](https://help.ishosting.com/en/server-administration#ddos-protection)
    - [Working with Files](https://help.ishosting.com/en/server-administration#working-with-files)
    - [Databases](https://help.ishosting.com/en/server-administration#databases)
    - [PHP](https://help.ishosting.com/en/server-administration#php)
    - [Logs and Statistics](https://help.ishosting.com/en/server-administration#logs-and-statistics)
    - [Diagnostics and Troubleshooting](https://help.ishosting.com/en/server-administration#diagnostics-and-troubleshooting)
    - [HestiaCP](https://help.ishosting.com/en/server-administration#hestiacp)
    - [cPanel](https://help.ishosting.com/en/server-administration#cpanel)
    - [aaPanel](https://help.ishosting.com/en/server-administration#aapanel)
    - [FastPanel](https://help.ishosting.com/en/server-administration#fastpanel)
    - [Other](https://help.ishosting.com/en/server-administration#other)
- [Mail](https://help.ishosting.com/en/mail#main-content)

    - [Getting Started](https://help.ishosting.com/en/mail#getting-started)
    - [ispmanager](https://help.ishosting.com/en/mail#ispmanager)
    - [DirectAdmin](https://help.ishosting.com/en/mail#directadmin)
    - [VestaCP](https://help.ishosting.com/en/mail#vestacp)
    - [Other Issues](https://help.ishosting.com/en/mail#other-issues)
- [VPN](https://help.ishosting.com/en/vpn#main-content)

    - [Getting Started](https://help.ishosting.com/en/vpn#getting-started)
    - [Android](https://help.ishosting.com/en/vpn#android)
    - [iOS](https://help.ishosting.com/en/vpn#ios)
    - [macOS](https://help.ishosting.com/en/vpn#macos)
    - [Mikrotik](https://help.ishosting.com/en/vpn#mikrotik)
    - [Linux](https://help.ishosting.com/en/vpn#linux)
    - [Windows](https://help.ishosting.com/en/vpn#windows)
    - [Amnezia VPN](https://help.ishosting.com/en/vpn#amnezia-vpn)
    - [Hysteria](https://help.ishosting.com/en/vpn#hysteria)
- [Data Storage](https://help.ishosting.com/en/data-storage#main-content)

    - [Getting Started](https://help.ishosting.com/en/data-storage#getting-started)
    - [Backups](https://help.ishosting.com/en/data-storage#backups)
    - [Other](https://help.ishosting.com/en/data-storage#other)
- [SSL Certificates](https://help.ishosting.com/en/ssl-certificates#main-content)

    - [Getting Started](https://help.ishosting.com/en/ssl-certificates#getting-started)
    - [Install](https://help.ishosting.com/en/ssl-certificates#install)
- [Affiliate Program](https://help.ishosting.com/en/affiliate-program)
- [​​Additional Services​](https://help.ishosting.com/en/additional-services#main-content)

    - [Additional IP](https://help.ishosting.com/en/additional-services#additional-ip)
    - [Control Panels](https://help.ishosting.com/en/additional-services#control-panels)
    - [Antivirus](https://help.ishosting.com/en/additional-services#antivirus)
- [Client Area](https://help.ishosting.com/en/client-area#main-content)

    - [Balance History](https://help.ishosting.com/en/client-area#balance-history)
- [Payment for Services](https://help.ishosting.com/en/payment-for-services#main-content)

    - [Getting Started](https://help.ishosting.com/en/payment-for-services#getting-started)
    - [My Account](https://help.ishosting.com/en/payment-for-services#my-account)
    - [Payments](https://help.ishosting.com/en/payment-for-services#payments)
    - [Other Issues](https://help.ishosting.com/en/payment-for-services#other-issues)
- [Documents and Policies](https://help.ishosting.com/en/documents-and-policies#main-content)

    - [General](https://help.ishosting.com/en/documents-and-policies#general)
    - [Company](https://help.ishosting.com/en/documents-and-policies#company)
- [Questions and Answers](https://help.ishosting.com/en/questions-and-answers#main-content)

    - [Control Panels](https://help.ishosting.com/en/questions-and-answers#control-panels)
    - [ispmanager](https://help.ishosting.com/en/questions-and-answers#ispmanager)
    - [Windows](https://help.ishosting.com/en/questions-and-answers#windows)
    - [Linux](https://help.ishosting.com/en/questions-and-answers#linux)
    - [Mail](https://help.ishosting.com/en/questions-and-answers#mail)
    - [Other](https://help.ishosting.com/en/questions-and-answers#other)
- [Special Offers](https://help.ishosting.com/en/special-offers)
- [is\*smart](https://help.ishosting.com/en/issmart#main-content)

    - [General Info](https://help.ishosting.com/en/issmart#general-info)
    - [Getting Started](https://help.ishosting.com/en/issmart#getting-started)
    - [API](https://help.ishosting.com/en/issmart#api)
    - [AI Models](https://help.ishosting.com/en/issmart#ai-models)
- [List of Apps](https://help.ishosting.com/en/list-of-apps)

[![is\*hosting](https://help.ishosting.com/hubfs/ishosting-logo-black.svg "is*hosting")](https://ishosting.com)

<https://www.facebook.com/ishostingcom> <https://twitter.com/ishostingcom> <https://www.instagram.com/is.hosting> <https://www.youtube.com/@ishosting> <https://www.linkedin.com/company/is-hosting>

Copyright © 2025, © Webrain OÜ