开发者 | tjdsneto |
---|---|
更新时间 | 2025年1月16日 07:38 |
WordPress版本: | 6.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/admin-debug-tools
directory, or install the plugin through the WordPress plugins screen directly.WP_DEBUG
mode enabled on a live site?It is generally not recommended to keep debug mode enabled on a live site, as it can expose sensitive information about your site and server, posing a security risk.
The main reason is that the default WP_DEBUG_LOG
constant saves the log file in the wp-content directory, which is publicly accessible. This can expose sensitive information about your site and server, such as file paths, database credentials, and other details that could be used by malicious actors.
To secure the debug log file, you can:
Debug log files can grow very large over time, especially on high-traffic sites or sites with many errors and warnings. Admin Debug Tools was built from the beggining having that in mind and, by default, will not load the entire log file at once, but only the last 1000 lines. The code is also optimized to avoid memory issues when loading large log files, but if you're experiencing performance issues, you can:
Admin Debug Tools needs write access to your wp-config.php
file to enable and disable debug mode. If you're seeing the error "The wp-config.php is not writable", you need to give write permissions to the file yourself or ask your hosting provider to do it for you.
You can change the permissions of the wp-config.php
file using an FTP client, a file manager in your hosting control panel, or via SSH. The file should have the permissions set to 644
or 640
.
Using SSH:
ssh
command to connect to your server. Replace username
and hostname
with your actual SSH username and server hostname.ssh username@hostname
```
2. Navigate to your WordPress directory:
- Use the cd
command to change to the directory where your WordPress installation is located.
cd /path/to/your/wordpress/directory
3. Check the existing permissions of wp-config.php
:
- Use the ls -l
command to list the file permissions.
ls -l wp-config.php
- The output will show the current permissions. For example:
-rw-r--r-- 1 username group 1234 Jan 01 12:34 wp-config.php
4. Update the permissions of wp-config.php
:
- Use the chmod
command to change the file permissions to 644
or 640
.
chmod 644 wp-config.php
- Or, to set the permissions to 640
:
chmod 640 wp-config.php
5. Verify the updated permissions:
- Use the ls -l
command again to confirm the changes.
ls -l wp-config.php
- The output should now reflect the updated permissions. For example:
-rw-r--r-- 1 username group 1234 Jan 01 12:34 wp-config.php
By default, only users with the manage_options
capability can access the Debug Log screen. This includes Administrators and Super Admins on multisite networks.
But you can change this by using the wp_debug_assistant_capability
filter. Here's an example of how you can change the capability to edit_posts
: