Title: Custom PHP Settings
Author: cyclonecode
Published: <strong>2019 年 2 月 25 日</strong>
Last modified: 2025 年 11 月 20 日

---

搜索插件

![](https://ps.w.org/custom-php-settings/assets/icon-256x256.png?rev=2053893)

# Custom PHP Settings

 作者：[cyclonecode](https://profiles.wordpress.org/cyclonecode/)

[下载](https://downloads.wordpress.org/plugin/custom-php-settings.2.4.1.zip)

 * [详情](https://cn.wordpress.org/plugins/custom-php-settings/#description)
 * [评价](https://cn.wordpress.org/plugins/custom-php-settings/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/custom-php-settings/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/custom-php-settings/#developers)

 [支持](https://wordpress.org/support/plugin/custom-php-settings/)

## 描述

This plugin can be used to customize php settings for you WordPress installation.

The plugin will modify either the **.htaccess** file or **.user.ini** file in order
to change the current php settings directly from within the settings page.

Since the configuration file needs to be modified this file **must** be writable
for this plugin to work as expected.

#### Apache module

When PHP is running as an Apache module the **.htaccess** file will be used to set
customized settings; make sure so that this file **exists** and is **writable** 
by the webserver.

#### CGI/Fast-CGI

If instead PHP is running in CGI/Fast-CGI mode then a custom INI file will be used.
The name of this file depends on the value of **user_ini.filename** in the php configuration,
by default it is **.user.ini**.
 You can check the name of you custom INI file in
the **PHP Information** table. The custom INI file should be placed under the root
folder and **most** be **writable** by the webserver.

Notice that there is also a **User INI file cache TTL** value in the information
table, this value tells how long the custom INI file will be cached before it gets
reloaded.
 For instance, if this value is set to 300 then any changes to your custom
INI file will not be reflected for up to 5 minutes. The name for this setting in
the php configuration is **user_ini.cache_ttl**.

One important thing is to make sure that your `.user.ini` file is blocked by your
webserver. If you are running NGINX this can be done by adding:

    ```
    location ~ /\.user\.ini {
      deny all;
    }
    ```

to your server configuration. The same thing using Apache is done by adding the 
following to the configuration if not already done:

    ```
    <Files .user.ini>
    order allow,deny
    deny from all
    </Files>
    ```

#### Available Settings

The settings table will display all non-system php settings that can be customized
by the plugin. All modified settings will be displayed in red in this table.

Some settings might be displayed in red because they are changed somewhere else,
perhaps through a customized php.ini file, by WordPress itself, a plugin or in some
other way.
 For instance if you have enabled **WP_DEBUG** in your **wp-config.php**
file the **error_reporting** setting will turn red.

If you have questions or perhaps some idea on things that should be added you can
also try [slack](https://join.slack.com/t/cyclonecode/shared_invite/zt-6bdtbdab-n9QaMLM~exHP19zFDPN~AQ).

#### Multiple Configurations

The premium version adds support for creating multiple named configurations which
all can hold their own custom PHP settings.
 You will then be able to easily switch
between the different configurations entries applying them to you configuration 
file.

#### Environment Variables

In the premium version, when running PHP as an apache module and using an **.htaccess**
file for configuration, you are able
 to add custom environment variables. These
will be accessible by using the super global **$_SERVER** array. In order for this
to work you will need to have the mod_env module enabled in your apache setup.

#### Resources

A complete list of settings that can be modified can be found here: [List of php.ini directives](http://php.net/manual/en/ini.list.php)

Notice that directives marked as `PHP_INI_SYSTEM` can not be modified.

### Warning

Make sure you know how a value should be configured and what different settings 
do before changing anything.
 This is important since some settings might render
your page inaccessible, depending on what value you are using. A good example of
this is the **variables_order** configuration:

> Sets the order of the EGPCS (Environment, Get, Post, Cookie, and Server) variable
> parsing. For example, if variables_order is set to “SP” then PHP will create the
> superglobals $_SERVER and $_POST, but not create $_ENV, $_GET, and $_COOKIE. Setting
> to “” means no superglobals will be set.

If this value would be configured to **EPCS** then no **$_GET** superglobal would
be set which would make your page inaccessible.

Another example is setting the **post_max_size** to a very low value so that no 
form data is sent to the server, which in turn would result in that form data is
never saved.

If you by mistake changed some value and your site is now inaccessible you could
simply manually remove everything from between the plugin markers in your **.htaccess**
file:

    ```
    # BEGIN CUSTOM PHP SETTINGS PRO
    php_value variables_order EPCS  <-- Remove
    # END CUSTOM PHP SETTINGS PRO
    ```

If you are running PHP in CGI/Fast-CGI mode then instead remove everything between
the plugins markers in your **.user.ini** file:

    ```
    ; BEGIN CUSTOM PHP SETTINGS
    php_value variables_order EPCS  <-- Remove
    ; END CUSTOM PHP SETTINGS
    ```

### Support

If you run into any trouble, don’t hesitate to add a new topic under the support
section:
 [https://wordpress.org/support/plugin/custom-php-settings/](https://wordpress.org/support/plugin/custom-php-settings/)

You can also try contacting me on [slack](https://join.slack.com/t/cyclonecode/shared_invite/zt-6bdtbdab-n9QaMLM~exHP19zFDPN~AQ).

## 屏幕截图

 * [[
 * Customize PHP settings from within WordPress administration.
 * [[
 * A `.htaccess` file with customized PHP settings.
 * [[
 * A table with all php settings that can be customized.
 * [[
 * Table displaying information about the current php environment.
 * [[
 * Listing of all enabled PHP extensions.
 * [[
 * All $_SERVER variables.
 * [[
 * All $_COOKIE variables.
 * [[
 * An example of backed up configuration files.
 * [[
 * Multiple settings are available in the premium version.
 * [[
 * The premium version supports setting environment variables.

## 安装

 1. Upload custom-php-settings-pro to the **/wp-content/plugins/** directory,
 2. Activate the plugin through the **Plugins** menu in WordPress.
 3. You can now modify your php settings by going to the settings page located under
    _wp-admin/admin.php?page=custom-php-settings-pro_.

## 常见问题

### I have saved a setting in the editor but the PHP setting does not reflect this?

Make sure so you have checked the _Update configuration file_ checkbox beneath the
editor.

## 评价

![](https://secure.gravatar.com/avatar/39ee98271b6d0af401bf594a274c0ddf636ce60e2f1d3d0d9c4c88cf6c10173b?
s=60&d=retro&r=g)

### 󠀁[very bad](https://wordpress.org/support/topic/very-bad-158/)󠁿

 [picklypickle](https://profiles.wordpress.org/picklypickle/) 2025 年 3 月 19 日

THE worst

![](https://secure.gravatar.com/avatar/daa89d2a0ce10421ad50a89d02691fb7334c5eb5f13c263459bf50fd020f5c56?
s=60&d=retro&r=g)

### 󠀁[Bad got worse](https://wordpress.org/support/topic/bad-got-worse/)󠁿

 [cantoute](https://profiles.wordpress.org/cantoute/) 2024 年 6 月 25 日 1 回复

The plugin is badly coded… could be handy but since last updates it has decided 
you needed a premium to set vars like post_max_size

![](https://secure.gravatar.com/avatar/caa0479b58a9d6203ac99edc2cded177c49468c0c41d19f67d14acddf8fb2b03?
s=60&d=retro&r=g)

### 󠀁[Amazing so Simple](https://wordpress.org/support/topic/amazing-so-simple/)󠁿

 [deffectrix](https://profiles.wordpress.org/deffectrix/) 2022 年 12 月 5 日

This is an awesome plugin, works like a charm. Thank you.

![](https://secure.gravatar.com/avatar/c70616123cce91c86d92b5515559973ba2c0bc1226be4e48ac68537f3d393adc?
s=60&d=retro&r=g)

### 󠀁[Best PHP-Settings Pluign](https://wordpress.org/support/topic/best-php-settings-pluign/)󠁿

 [offloris](https://profiles.wordpress.org/offloris/) 2022 年 6 月 5 日

When i downloaded the Plugin i have thinked that it wouldnt be work but i was shocked.
It worked!!! Thank you!

![](https://secure.gravatar.com/avatar/239556da976d799f646626bdddfad7a4eb9dd29924c51e71b90bcb7f90c2cd10?
s=60&d=retro&r=g)

### 󠀁[Gorgeous Plugin](https://wordpress.org/support/topic/gorgeous-plugin-6/)󠁿

 [osandigital](https://profiles.wordpress.org/osandigital/) 2022 年 5 月 18 日

This is just “simply” beautiful. Thank you for this. Time-saving.

![](https://secure.gravatar.com/avatar/1af6576b77bb9a70f3e5be2921769896502f27e43d7ac83a1f1293cb414eea3c?
s=60&d=retro&r=g)

### 󠀁[Good one](https://wordpress.org/support/topic/good-one-535/)󠁿

 [barnabas1](https://profiles.wordpress.org/barnabas1/) 2022 年 1 月 29 日

Works for me absolutely fine! Thank you for your work.

 [ 阅读所有15条评价 ](https://wordpress.org/support/plugin/custom-php-settings/reviews/)

## 贡献者及开发者

「Custom PHP Settings」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ cyclonecode ](https://profiles.wordpress.org/cyclonecode/)

「Custom PHP Settings」插件已被翻译至 1 种本地化语言。 感谢[所有译者](https://translate.wordpress.org/projects/wp-plugins/custom-php-settings/contributors)
为本插件所做的贡献。

[帮助将「Custom PHP Settings」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/custom-php-settings)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/custom-php-settings/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/custom-php-settings/)，或通过[RSS](https://plugins.trac.wordpress.org/log/custom-php-settings/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/custom-php-settings/)。

## 更新日志

= 2.4.1

 * Update: Freemius SDK to 2.13.0.
 * Update: Add more WordPress information.
 * Update: Add Server Software in status page.

## 额外信息

 *  版本 **2.4.1**
 *  最后更新：**5 月前**
 *  活跃安装数量 **10,000+**
 *  WordPress 版本 ** 4.1.0 或更高版本 **
 *  已测试的最高版本为 **6.8.5**
 *  PHP 版本 ** 5.6 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/custom-php-settings/) 和 [Swedish](https://sv.wordpress.org/plugins/custom-php-settings/).
 *  [翻译成简体中文](https://translate.wordpress.org/projects/wp-plugins/custom-php-settings)
 * 标签
 * [Apache](https://cn.wordpress.org/plugins/tags/apache/)[htaccess](https://cn.wordpress.org/plugins/tags/htaccess/)
   [php](https://cn.wordpress.org/plugins/tags/php/)[settings](https://cn.wordpress.org/plugins/tags/settings/)
 *  [高级视图](https://cn.wordpress.org/plugins/custom-php-settings/advanced/)

## 评级

 4.4 星（最高 5 星）。

 *  [  12 条 5 星评价     ](https://wordpress.org/support/plugin/custom-php-settings/reviews/?filter=5)
 *  [  1 条 4 星评价     ](https://wordpress.org/support/plugin/custom-php-settings/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/custom-php-settings/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/custom-php-settings/reviews/?filter=2)
 *  [  2 条 1 星评价     ](https://wordpress.org/support/plugin/custom-php-settings/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-php-settings/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/custom-php-settings/reviews/)

## 贡献者

 *   [ cyclonecode ](https://profiles.wordpress.org/cyclonecode/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/custom-php-settings/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://www.buymeacoffee.com/cyclonecode)