如何通过 PHP Selector 在 cPanel 与 DirectAdmin 中启用 display_errors

以下是中文版的 iCoreHosting 知识库文章(无表情符号):


如何通过 PHP Selector 在 cPanel 与 DirectAdmin 中启用

display_errors

 

display_errors 功能可让您在网站页面上直接显示 PHP 错误信息,方便开发调试。本指南将说明如何在 cPanelDirectAdmin 的 PHP Selector 中启用该功能。

 

重要提示:

请仅在调试时临时开启 display_errors

调试完成后务必关闭,以免在正式网站上暴露敏感错误信息。


对于 cPanel 用户

  1. 登录 cPanel

  2. 下拉页面,点击「Select PHP Version」(在「Software」或「软件」栏目下)。

  3. 点击页面中的「Options」选项卡。

  4. 找到 display_errors 项。

  5. 勾选以启用该选项。

  6. 设置将自动保存。

 

**调试后关闭方法:**取消勾选 display_errors 即可。


对于 DirectAdmin 用户

  1. 登录 DirectAdmin

  2. 进入「Extra Features」>「Select PHP Version」(或「PHP Selector」)。

  3. 点击「Options」选项卡。

  4. 找到 display_errors 项。

  5. 通过下拉菜单将其设置为 On(开启)。

 

**调试后关闭方法:**将其切换回 Off(关闭)即可。


(可选)WordPress 用户可使用以下方式

 

如您使用的是 WordPress,也可通过编辑网站根目录的 wp-config.php 文件来开启:

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);

调试完成后,请关闭:

define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

最后提醒

  • 切勿在正式网站上长期开启 display_errors

  • 调试完毕后,请记得关闭以确保网站安全。

  • 若需要更详细的错误信息,建议查看主机的 error_log 文件。

 

如需更多帮助,请访问:https://www.icore.com.my/support

 

  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

How to Obtain cPanel Login Information from Your Current Hosting Provider for Transfer to iCoreHosting

How to Obtain cPanel Login Information from Your Current Hosting Provider for Transfer to...

How to Reset Your Email Login Password via cPanel

If you've forgotten your email login password or need to reset it for security reasons, you can...

How to Log into cPanel Through iCore Hosting Billing Portal

How to Log into cPanel Through the iCore Hosting Billing Portal Table of Contents Service...

How to Connect Outlook Email for the cPanel Control Panel at iCoreHosting

How to Connect Outlook Email for the cPanel Control Panel at iCoreHosting This guide provides...

How to Create a MySQL Database in cPanel

Creating a MySQL database in cPanel is a straightforward process. Follow these steps to set up a...