Super-short version:
It should get rid of the “[an error occurred while processing this directive]” error, and will fix many other annoying WordPress issues arising from file permissions.
Longer version:
I recently transferred my WordPress website to a new host.
After I deployed the backup, I got the lovely 500 Internal Server Error message the first time I went the website.
So, I replaced my super-customized .htaccess file with the WordPress default .htaccess file [download here].
That got rid of the 500 error, but then when I refreshed the page, I got…
Wonderful!
I poked around with FTP and noticed that the permissions of files and folders on the site had all been set to 666. I deleted all the files and extracted my backup using a different method … same result. “OK,” I thought. “Maybe the backup is bad, but I don't have another one.”
Using FTP, I had a look through a couple other functional WordPress websites and noticed that:
- all files had their permissions set to 644
- all directories were set with 755 permissions.
I've found that incorrect file permissions are usually the reason why a WordPress website doesn't work after moving it to a different server or host. Honestly, it's my #1 frustration with WordPress and has, on occasion, ruined entire days for me. Usually, I just use FileZilla to set the permissions — but that can take hours!
So, I decided it was time to create (or find) a PHP script that would recursively go through every single directory on my site and set permissions automatically.
After a bit of Googling and testing, I was able to put a PHP script together which completely fixed the problem.
To fix this annoying issue on your website:
- Download this PHP script which will automatically set permissions of all directories to 755, and all files to 644.
- If you need, you can edit the script to change the permissions to any other value.
- Unzip it and upload the PHP file to the root folder of your website.
- Go to yourdomain.com/php_permissions_755_644.php
- After a moment, a list of files and directories will appear, which means the script has set the permissions successfully.
As always, I recommend deleting the script from your server once you've used it – it's not the kind of thing you want to leave around for a hacker to exploit.
Script borrowed/hacked/modified from this Stack Overflow page.
Louis
wow, Thank you very much.
After the transfer, i spent the last two days trying to figure out what wrong. I changed all the database and user and hta file. all. till I gave up and found your article only to realise permissions is the one thing I did not check. Thank you very much. You are a legend
Fab Mam
Hello, does this work for multi-sites too?
Leopoldo Javier Gomez
Hombre, eres un maestro, llevava dias con este tema, muchas gracias
Manuel
I migrated a website to a new host and neww domain I can loging to backend but frontend gives [an error occurred while processing this directive] and all other pages give a 404 error
i checked the permission on the server and they are 755 for folders and 644 for files. my .htacces seems to be the defaul of wordpress.
No idea where to loook further for a solution to the problem.
Any ideas?
Joe E Mester
I’d buy you a beer and a shot of whiskey in every bar… Thank you
Dennis
my issue had to do with a bad .htaccess file. So your first solution was simple and perfect
fahmi474
salute for this content
Judy
Hi,
Sorry, I do not get it where I have to upload the script. Could you please help me out?
Thanks
Judy
Jody Hatton
(If you haven’t already figured this out — sorry for the super-delayed reply…)
Just put it in the root folder of your website, then visit the link in your browser to run the script.
And then be sure to delete the script afterwards. 😉
Lubin Leonardo
Look at this! It worked for me. Solution No. 1 Greetings from Colombia 😀
Vikash Kumar
Many thanks, my friend!
Linda
Many thanks, my friend!
Vince
Thank you so so so much!
You literally saved my life.
Sally Black
Thank you!! This worked perfectly!
Raffi
Big Thank You! from Armenian WebMaster! WORKED!
Don Merrow
Very useful, Thank You,
Taylor Hall
Hi Jody,
Thank you so much for the article. Been trying to find a solution for the past 2 hours.
Tried steps 1-5 but am still getting the [an error occurred while processing this directive] error. Any ideas?
Best regards,
Taylor
Jody Hatton
After refreshing the root directory in FTP, have you verified that the permissions have all been set to 755/644?
If so, and it still isn’t working, your host may have their own permissions settings — you might need to give them a call.
Taylor Hall
The underlying issue, after your solution, was our .htaccess file. All good now.
Thank you Jody.
Jody Hatton
Ack! That’ll do it! Glad you got it worked out, and thanks for sharing your experience for the benefit of all. 😉
Ashish Ajani
You have been a tremendous help!
Thanks man, I had the same issue as you described and finally I got the solution after reading article you posted.
Thank you very much again 🙂
Jody Hatton
Hooray! 🙂
Brian
Saved me countless hours of troubleshooting (already 4 hours in). Thanks!
Jody Hatton
Ouch! I’m glad it worked for ya. 🙂
Eric
Thumbs up for the tips man, it worked like a charm on bluehost 🙂
Channing
Eric are you sure?