Global Header
4 Mins Read

Change PHP Display Errors Setting for Debugging and Security

Home Blog Security Change PHP Display Errors Setting for Debugging and Security
What is a DKIM record? Protecting email communications is important in today's digital environment. Using DKIM record (DomainKeys Identified Mail) is a common technique for protecting email integrity and thwarting phishing attempts. This article will cover the definition of DKIM records, their significance for email security, and how to configure them for your domain. What is a DKIM Record? Importance of DKIM Records How Does DKIM Records Work How to Enable DKIM Records How to View DKIM Records How to Troubleshoot Common DKIM Record Issues Summary What is a DKIM Record? A DKIM ((DomainKeys Identified Mail) record is used to authenticate an email message. It enables the recipient's email server to verify that an email was sent by an authorized server and that the email content has not been altered while in transit. DKIM adds a digital signature to emails using a secret key. In order to verify the message's integrity and origin, the receiving server then verifies this signature using a public key. If all of the DKIM details match, the email is deemed legitimate. Importance of DKIM Records Here are several reasons why DKIM records are essential for email security. Email authentication: DKIM assists with email authentication, making sure that the email you receive is indeed from the sender you think it is. Without appropriate authentication, emails are easily spoofable or impersonated. Enhance email security: When used along with SPF records, DKIM allows DMARC to be used for added email security. Prevent phishing and spoofing: DKIM reduces the risks of phishing and email spoofing by confirming the message's legitimacy. Improve email deliverability: By configuring DKIM, you can raise the likelihood that your emails will reach your Inbox rather than being flagged as spam. Boost sender reputation: A correctly configured DKIM record will improve your domain's standing with email service providers, resulting in better placement in inboxes. How Does DKIM Records Work DKIM authentication uses asymmetric encryption to verify emails. Here’s a simplified breakdown of how DKIM works. Signing the email: Your mail server generates a DKIM signature using a private key and appends it to the email header whenever you send an email. Verification by the recipient's server: To verify the DKIM record, the recipient's mail server obtains the public key from the sender's DNS. Comparing the signature: The recipient's server utilizes the public key to check if the DKIM signature matches the email. If it does, the email is regarded as authentic. How to Enable DKIM Records WHM This section is applicable only to customers on VPS and Dedicated hosting. Log in to WHM. Within WHM, search for List Accounts using the search bar on the top left. WHM - List Accounts On the List Accounts page, look for the domain of your email account (sending email) and click the expand icon beside the domain to view more options. Click on the Modify Account button. List Accounts - Modify Account button On the next page, scroll down to the DNS Settings section, then put a checkmark on Enable DKIM on this account. Enable DKIM on this account Once done, cPanel will generate the domain's DKIM records. cPanel This section is applicable only to customers who are on Shared hosting. Log in to cPanel. Click Email Deliverability under the Email section. Email - Email Deliverability Locate your domain and check its Email Deliverability Status. If it says "Valid," then the DKIM & SPF are Enabled. Email - Email Deliverability Status If it says "Problems Exist (...)," click the Repair button. Email - Email Deliverability Status - Problems Exist How to View DKIM Records WHM In WHM, search for DNS Zone Manager using the search bar on the top left. WHM - DNS Zone Manager Look for the email account's domain and click its Manage button. WHM - DNS Zone Manager - Manage button Search for the domain and its TXT records similar to the image below. DKIM records - TXT value cPanel In your Bluehost account, click Email Deliverability under the Email section. Email - Email Deliverability On the domain's page, locate the domain and click on its Manage link. Email - Email Deliverability - Manage button You will see the DKIM record Name and its Value. Email - Email Deliverability DKIM Record Value How to Troubleshoot Common DKIM Record Issues Here are some of the common issues encountered with DKIM records. Incorrect DKIM record format: Verify that the DNS settings have the public key formatted correctly. Verification may fail if a DKIM record contains extra spaces or characters. Double-check that the public key is correctly formatted and without syntax errors. Delay in DNS propagation: After a DKIM record is added (or updated), it could take some time for DNS updates to spread throughout the network. The DKIM record usually takes 24 to 48 hours to complete propagation. A mismatch between the DKIM signature and email content: The DKIM signature will not pass verification if the email content is changed after it has been signed. To prevent this problem, ensure that the email's body and headers stay the same after signing in order to preserve the integrity of the DKIM signature. Summary In the current digital age, safeguarding email communication has become increasingly important. One reliable approach to ensuring email integrity and protecting against phishing attacks is using a DKIM record. A DKIM record acts as a digital signature that validates email messages, enabling the recipient's mail server to confirm both the email's origin and its integrity. This article discusses what DKIM records are, their importance, how they function, and step-by-step instructions on enabling and managing DKIM records for your domain. Secure your email communications today by prioritizing the configuration of the DKIM record.

When building or maintaining a PHP-based website, controlling error visibility is crucial for debugging and securing your site. The Change PHP Display Errors Setting option allows you to enable or disable error messages based on your needs. In this guide, we’ll walk you through how to modify the display_errors directive in PHP to ensure that your error reporting aligns with your development or security goals.



PHP Error Display Directive

The display_errors directive in the PHP configuration file (php.ini) controls the PHP error display setting. When display_errors is set to “On“, any errors occurring in your PHP scripts will be visible to visitors on your website. This can be extremely useful during development, allowing developers to diagnose and fix issues quickly. However, displaying these error messages publicly on a live website is a security risk.

Why is Displaying Errors a Security Risk

Error messages often reveal sensitive information such as file paths, database queries and internal server details, which attackers could exploit to gain unauthorized access to your site or server. Therefore, disabling error displays in production environments is the best practice to protect your site and visitors.

When display_errors is set to “Off“, PHP will not show any errors to website visitors. Instead, errors are logged into a file, which allows you to track and resolve issues without exposing sensitive details to the public. This helps you maintain a secure and user-friendly environment for your website visitors.

How to Change PHP Display Errors Setting

To adjust the display_errors setting in PHP, follow these steps:

  1. Locate the php.ini file:
    The php.ini file is typically found in your server’s root directory. In shared hosting environments, it is located in the public_html directory.
  2. Modify the display_errors directive:
    Open the php.ini file and search for the line containing display_errors.
    To enable error display, set it to On: display_errors = On To disable the error display, set it to Off: display_errors = Off
  3. Save the changes and restart the server:
    After making changes to the php.ini file, save it and restart your web server for the settings to take effect. This ensures that your updated PHP configuration is applied correctly.

Using PHP in Different Environments

The location of the php.ini file can vary depending on the environment in which you’re running PHP. Here’s a breakdown of some common scenarios:

  • Shared Hosting: If you’re using shared hosting, the php.ini file is typically located in the public_html directory.
  • Dedicated Servers or VPS: On dedicated servers or VPS, the php.ini file is generally located in the root directory of your PHP installation. You may have access to modify this file directly.
  • PHP with FastCGI or Single PHP Script: If you’re using PHP with FastCGI or running a single PHP script, modify the php.ini file in the directory where your scripts are executed. You may also need to create a custom php.ini file in specific directories to apply different settings for individual scripts.

For more detailed instructions, see our article on How to Edit PHP INI Settings. If you’re working with multiple PHP environments, it’s worth reading up on how to Configure the PHP Environment with php.ini.

Common Troubleshooting for PHP Error Settings

Sometimes, changes to php.ini may not take effect immediately. Here are a few common troubleshooting tips:

  • Verify PHP version: Ensure that the version of PHP you’re using supports the changes you’ve made. Some settings may be overridden by PHP version-specific configurations.
  • Check for multiple php.ini files: If you use multiple PHP installations or server configurations (like FastCGI), ensure you edit the correct php.ini file for the active environment.
  • Restart the server: Always restart your web server after modifying php.ini to ensure changes take effect. If you don’t restart, the settings may not be applied.
  • Error logs: If you still have issues, check your PHP error logs for more detailed messages about what might be going wrong.

Summary

Changing PHP display error settings is essential for debugging and securing your site. Adjusting the display_errors directive in your php.ini file lets you control whether error messages are shown on your website. Enabling error displays during development can be helpful for troubleshooting. Still, turning off error displays in production environments is critical to prevent sensitive information from being exposed to the public.

To balance effective error handling with security, regularly review your settings and ensure you follow best practices for your PHP environment.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support – While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support –
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration and troubleshooting steps.

  • I write and curate content for Bluehost. I hope this blog post is helpful. Are you looking at creating a blog, website or an online store? Bluehost has something for everyone. Get started today.

Learn more about Bluehost Editorial Guidelines
View All

Write A Comment

Your email address will not be published. Required fields are marked *

Longest running WordPress.org recommended host.

Get Up to 61% off on hosting for WordPress Websites and Stores.