Wordpress LScache Plugin: Plugin could not be activated because it triggered a fatal error.
Last Updated on: Wed, 15 Apr 2026 00:00:02 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? 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. Hi @greencode If you dont 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. Youve already fixed it on my site via UK Dedicated (GURU) who got in touch with you about this issue. 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, /) 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 isnt 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/
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference