[an error occurred while processing this directive]

Hi,
I have a problem that only happen with the root site that for some reason between time and then the page fail to load and show this message:

[an error occurred while processing this directive]

I looked it up and the problem seems to file permission not set write so I added this PHP script to my main folder to check if there is any files with wrong permissions and it find these four :
File: /home/bankalaf/public_html/tamrah/wp-content/wflogs/config.php
File: /home/bankalaf/public_html/tamrah/wp-content/wflogs/rules.php
File: /home/bankalaf/public_html/tamrah/wp-content/wflogs/ips.php
File: /home/bankalaf/public_html/tamrah/wp-content/wflogs/attack-data.php

the script as I understand should fix it put the problem is whenever their permission reset it goes back to their old one. which are for some 660 or 664 I tried reset them using FTP but without luck.

  • tamim
    <?
    
    header('Content-Type: text/plain');
    
    /*
    * Recursively changes permissions of files and directories within $dir and all subdirectories.
    * This script by XDude: http://www.xdude.com/
    * Original script borrowed from http://stackoverflow.com/questions/9262622/set-permissions-for-all-files-and-folders-recursively
    */
    
    function chmod_r($dir)
    {
        $dp = opendir($dir);
        while($file = readdir($dp))
        {
            if (($file == ".") || ($file == "..")) continue;
    
            $path = $dir . "/" . $file;
            $is_dir = is_dir($path);
    
            set_perms($path, $is_dir);
            if($is_dir) chmod_r($path);
        }
        closedir($dp);
    }
    
    function set_perms($file, $is_dir)
    {
        $perm = substr(sprintf("%o", fileperms($file)), -4);
        $dirPermissions = "0755";
        $filePermissions = "0644";
    
        if($is_dir && $perm != $dirPermissions)
        {
            echo("Dir: " . $file . "\n");
            chmod($file, octdec($dirPermissions));
        }
        else if(!$is_dir && $perm != $filePermissions)
        {
            echo("File: " . $file . "\n");
            chmod($file, octdec($filePermissions));
        }
    
        flush();
    }
    
    chmod_r(dirname(__FILE__));
    
    ?>

    this is the script I used

  • Adam Czajczyk

    Hello tamim,

    I hope you're fine today and thank you for your question!

    I'd like to ask you to clarify the case a bit more.

    Could you please explain where do you get this error: is it within some plugin or a theme (e.g. when you run some task or set some options)? When does it happen? Are there any additional information on what "directive" that is that you're referring to?

    That could help a lot :slight_smile:

    Looking forward to your reply,
    Adam

  • Predrag Dubajic

    Hi Tamim,

    I was doing some research about this error and in addition to folder permissions there seem to be some other stuff that could be causing this.

    One of those, with the easiest fix, is the permalinks, can you try going to Settings > Permalinks and in there change the Permalinks settings to Default, save the settings and then select the ones you had originally and save it again.

    There were some reports with comments in PHP code that sometimes break SSL directives, fix for this would be to go through code and find any PHP comments and make sure they all have a space after opening comment tag and before closing comment tag.
    For example, this:
    <!--#this is some comment-->
    Should be this:
    <!-- #this is some comment -->

    Other things include PHP configuration and server settings themselves so it would be helpful to get in touch with your hosting provider as they should be able to assist you more with that part.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.