Bobcares

How to Fix “Forbidden: PHP engine is disabled” DirectAdmin Error

by | Jan 20, 2025

Learn how to fix the “Forbidden: PHP engine is disabled” DirectAdmin error. Our DirectAdmin Support team is here to help you with your questions and concerns.

How to Fix “Forbidden: PHP engine is disable” DirectAdmin Error

How to Fix “Forbidden: PHP engine is disable” DirectAdmin ErrorThe “Forbidden error,” also known as the HTTP 403 error, is a common issue that webmasters encounter. This error indicates that while the server understands the request, it refuses to authorize access. In a DirectAdmin web hosting environment, the error is often due to incorrect file and directory permissions, ownership settings, or misconfigurations in server settings.

Today, we will look at the causes of this error and the step-by-step solutions.

What is the Forbidden Error?

The HTTP 403 Forbidden error is an HTTP status code that signals access to a requested resource has been denied. Common causes of this error include:

  1. Permissions set too restrictively may block access.
  2. Incorrect ownership of files or directories.
  3. .htaccess File: Erroneous or restrictive rules in the `.htaccess` file.
  4. Absence of a default index file like `index.php` or `index.html.`
  5. Directives in server settings that restrict access.

Understanding the root cause is the key to resolving this error effectively.

Common Causes in DirectAdmin

  1. PHP Access is Disabled

    Error: “Forbidden: PHP engine is disabled.”

    Here, PHP support for the domain is disabled in DirectAdmin.

  2. File or Directory Permissions

    Permissions that prevent the server from executing PHP scripts or serving files.

    Typical permissions include:

    • Directories: `755`
    • Files: `644`
  3. Misconfigured `.htaccess` File

    Restrictive or erroneous rules in the `.htaccess` file that block access to resources.

Step-by-Step Solutions

1. Enable PHP Access in DirectAdmin

If PHP access is disabled, follow these steps:

  1. Log in to DirectAdmin.
  2. Navigate to Domain Setup and select Modify for the domain.
  3. Also, enable the checkbox for PHP Access.
  4. Then, click Save to apply changes.

2. Check and Configure PHP in Plesk

If using Plesk, ensure PHP is enabled and properly configured:

  1. Log in to your Plesk Panel.
  2. Go to the Websites & Domains tab.
  3. Then, expand Hide Advanced Operations and select Website Scripting and Security.
  4. Ensure the PHP Support option is enabled.
  5. Then, set the PHP handler to the Apache module in the Run As field.
  6. Click OK to save changes.

3. Fix File and Directory Permissions

Improper permissions can cause the server to block access to files or directories. Correct permissions as follows:

  1. Set directories to `755` and files to `644` using these commands:


    find /home/username/domains/domain.com/public_html -type d -exec chmod 755 {} \;
    find /home/username/domains/domain.com/public_html -type f -exec chmod 644 {} \;

  2. Also, ensure ownership of the files matches the web server user (e.g., `username:username`).

4. Inspect and Fix the .htaccess File

  1. Open the `.htaccess` file located in the website’s root directory.
  2. Look for and comment out restrictive rules that might block access.
  3. Ensure the file contains the correct directives to allow PHP execution.

5. Verify the PHP Version and Handler

  1. Log in to DirectAdmin as an admin.
  2. Check the PHP version and handler for the domain (e.g., FastCGI or Apache module).
  3. Then, ensure the selected PHP version is compatible with your website.

6. Check Server Logs

Server logs often contain detailed information about errors:

  1. View Apache error logs and DirectAdmin logs for more insights.
  2. Common log locations:
    • Apache logs: `/var/log/httpd/error_log` or `/var/log/apache2/error.log`
    • DirectAdmin logs: `/var/log/directadmin/error.log`

7. Review ModSecurity Rules

If ModSecurity is enabled, legitimate requests might be blocked. To resolve:

  1. Check the ModSecurity logs for blocked requests.
  2. Also, whitelist or modify rules as needed to allow access.

Prevention Tips

  • Always confirm that PHP is enabled for the domain.
  • Maintain proper permissions (`755` for directories, `644` for files).
  • Furthermore, avoid restrictive or erroneous rules.
  • Also, regularly update DirectAdmin and server modules to avoid compatibility issues.
  • Make changes in a staging environment to identify potential issues before deployment.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

The “Forbidden: PHP engine is disabled” error in DirectAdmin can stem from several causes, including PHP settings, file permissions, or server configuration issues. We can diagnose and resolve the error by following the above solutions.

In brief, our Support Experts demonstrated how to fix the “Forbidden: PHP engine is disabled” DirectAdmin error.

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.