wordpress 对 wp-config.php 的更改何时生效?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11603487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When do changes to wp-config.php take effect?
提问by Gabriel Southern
I am trying to enable debugging on a WordPress site to debug a plugin. I read about the WP_DEBUGsetting and I added the following to my wp-config.php
file:
我正在尝试在 WordPress 站点上启用调试以调试插件。我阅读了WP_DEBUG设置,并将以下内容添加到我的wp-config.php
文件中:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
My understanding is that I should see a debug.log
file in my wp-content
directory. I haven't seen anything yet, but I don't know if that is because there aren't any errors that have been logged, or if something needs to be restarted for these settings to take effect. So my question is when are the wp-config.php
settings read and do I need to restart any services to make changes take effect.
我的理解是我应该debug.log
在我的wp-content
目录中看到一个文件。我还没有看到任何东西,但我不知道这是因为没有记录任何错误,还是需要重新启动某些设置才能使这些设置生效。所以我的问题是什么时候wp-config.php
读取设置,我是否需要重新启动任何服务以使更改生效。
回答by markratledge
"Changes" to wp-config.php
take place right away when edited by FTP or via the shell, because that file is accessed each time any page is generated and output by WordPress. No reboot of the server is needed; just do a load or a refresh of any front or backend page of the WordPress site.
“更改”wp-config.php
在通过 FTP 或通过 shell 编辑时立即发生,因为每次 WordPress 生成和输出任何页面时都会访问该文件。无需重启服务器;只需加载或刷新 WordPress 网站的任何前端或后端页面。
Do something to trigger a php error, like removing a bracket from a php function in header.php
of the theme and see if that gets logged in debug.log
. Check for the error in debug.log
in wp-content
.
执行一些操作来触发 php 错误,例如从header.php
主题中的 php 函数中删除括号,然后查看是否已登录debug.log
。在检查错误debug.log
的wp-content
。
If the file doesn't exist, there may be permission problems and WordPress couldn't create the file. So add a plain text file (with the correct text encoding for your system; it's best to use the FTP client to create a few file) and title it debug.log
. If you create the file locally and upload it, give it at least 755 permissions, but 644 is safer. Then invoke a php error again and see if it gets logged.
如果该文件不存在,则可能存在权限问题,WordPress 无法创建该文件。因此,添加一个纯文本文件(使用适合您系统的正确文本编码;最好使用 FTP 客户端创建一些文件)并将其命名为debug.log
. 如果在本地创建文件并上传,至少给它 755 的权限,但 644 更安全。然后再次调用一个 php 错误并查看它是否被记录。