Ok, so if you decide to use Drush (4) and decide to upgrade your installation of Drupal (6.2x) then perhaps you’ll experience a little problem. This problem has happened to me quite a few times now and that is why I am writing this post. I don’t want this to happen either to me or to anybody in the future. If it happens, then here are the instructions on how to fix it.
Let’s start by saying what doesn’t work:
1. My first thought was to check for the error log to see if it gave me better clues at what was happening with the Drupal site after the drush update command (drush up). Now, before we continue, remember that before you hit ENTER on that command, make a copy of your htaccess file and of your robots.txt. Believe me, this will make it easier on you.
2. I checked the error log and it basically told me the following:
“[Date [crit] [client 22.214.171.124(ip address)] (13)Permission denied: /home/user/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable”.
3. I thought then that it had to do with the permissions of the htaccess file (chmod). However that is not what causes the problem.
4. When I tried that it didn’t work.
5. Then I changed the ownership of the files recursively on the entire root and sure enough it didn’t work either. Simply because the problem happens because the public_html folder alone has to have the group ownership set to “nobody”. Can you believe that? How do you do that? With the command “chown” (Change Ownership) the first parameter is the username, the second one is the group. So for example if you say chown alex:nobody myfolder/ , then you are assigning the ownership of myfolder/ to user alex and group “nobody”.
Why does it happen in the first place?
First the problem happens because you are logged it with a different user with SSH into your server. That alone is going to make the Drush calls from that user. So if you call the drush commands without changing your user, of course you are going to end you changing your ownership of the files.
Merkados’ Recommended Solution
So here are the changes that need to happen:
/*Comment of Code*/ #chown -R ftp_username:ftp_username path_to_drupal_home_folder #chown ftp_username:nobody path_to_drupal_home_folder /*End of Code*/
1. The chown command is used to change the ownership of the files. In the first line you are changing ownership recursively of all the drupal files and assigning it to the user with ftp access and group with the same name.
2. The second line makes the change to the home folder. Please note that the group is set to “nobody” and please also note that it is not recursive so don’t use the -R!
That’s it. If you follow this instructions you will be avoiding those 403 forbidden notices and doing more work. Don’t worry about the fact that the error logs instruct you about lack of read-access to .htaccess. Obviously this problem is generated by the ownership problem described here. Once you fix the problem with the ownership, then you won’t have the error with your htaccess file.
Please don’t hesitate to contact Merkados for your strategic interactive media needs.