Support » Plugin: LiteSpeed Cache » Plugin could not be activated because it triggered a fatal error.

  • Resolved greencode

    (@greencode)


    I have this plugin installed on all of my sites on the same server but just attempted to activate on a new site and get the following error:

    Warning: file_put_contents(//.htaccess): failed to open stream: Permission denied in /home/mysite/public_html/site/wp-content/plugins/litespeed-cache/admin/class-litespeed-cache-admin-rules.php on line 621
    ERROR 9020: Failed to put contents into .htaccess

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Hi @greencode

    Could you check the permissions for the .htaccess file? Sometimes, the permissions may be altered such that the file is not writable for security reasons. In these situations, we cannot write to the file.

    Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Hi @greencode

    If you don’t mind modifying code, we have a fix for the issue.

    In the file wp-content/plugins/litespeed-cache/admin/class-litespeed-cache-admin-rules.php:

    The modifications need to be made to the path_set function ~ line 224

    
    	                $install = ABSPATH;
    	                $access = get_home_path();
    

    Needs to be replaced with:

    
                    $real = trailingslashit(realpath(ABSPATH));
                    $install = $real;
                    $access = trailingslashit(realpath(get_home_path()));
    

    And later,

    
    	                else {
    	                        // they are equal - no need to find paths.
    	                        $this->home_path = ABSPATH . '.htaccess';
    	                        $this->site_path = ABSPATH . '.htaccess';
    	                        return;
    	                }
    	                $common_path = substr(ABSPATH, 0, -(strlen($install_part) + 1));
    

    Should be replaced with:

    
                    else {
                            // they are equal - no need to find paths.
                            $this->home_path = $real . '.htaccess';
                            $this->site_path = $real . '.htaccess';
                            return;
                    }
                    $common_path = substr($real, 0, -(strlen($install_part) + 1));
    

    After that, the error should no longer occur.

    Let us know if you have any questions about this!
    Kevin

    Thanks for this. No need though. You’ve already fixed it on my site via UK Dedicated (GURU) who got in touch with you about this issue.

    Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Glad to hear it, let us know if you run into any more issues!

    Cheers,
    Kevin

    I am looking through this file you mention but the lines you mention arenot in the file, i have searched the file and cant find:

    $install = ABSPATH;
    $access = get_home_path();

    What am i doing wrong, at line 224 i find:
    }
    else {
    $common_path = rtrim($common_path, ‘/’);
    }

    Plugin Author LiteSpeed Technologies

    (@litespeedtech)

    Hi @hampmir

    This issue should have been resolved with the latest releases. What version are you using and what problems are you experiencing?

    Cheers,
    Kevin

    I just updated the plugin so i am using the latest version. I am also using the latest version of WordPress so i guess it isn’t totally fixed :/

    I have described my issues in a seperate thread so i dont hijack this one 🙂
    https://wordpress.org/support/topic/fatal-error-when-activating-46/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin could not be activated because it triggered a fatal error.’ is closed to new replies.