Magento – Problems with Permissions and write access for Magento Connect when trying to install extensions

magento-1.9magento-connect

I am trying to setup Magento (community edition 1.9.1) on our shared hosting server. I am pretty new to Magento, though I did get a dummy site set up fairly easily on a local machine.

The problem that I am facing is that whenever I try to install an extension through Magento Connect I get various cannot write, cannot access etc errors.

I have set all the permissions to 777 via Filezilla, but there are certain files that are created by Magento that I cannot modify via FTP. If I log into the plesk panel for the site it says that those files/folders have the user Apache, and I can only modify them through the file manager interface. I can get it to proceed to some extent by manually creating the folders it is asking for through file manager but obviously this is slow and tedious and ultimately I still end up with a giant list of inaccessible files.

I hoped to get around this by using the FTP deployment but that give me error:

deployment ftp error. cannot chdir after login

Is there something that I am doing wrong? I have spent the day ploughing through google searches and forum posts and none of the solutions there seem to solve the problem. Do I need to contact the hosting provider?

Best Answer

Be thankful you're getting permission errors -- there's a few cases where Magento Connect runs into permission problems but reports the extension as installed.

What you need to do is going to depend heavily on how you're running PHP/Apache, but making an educated guess based on the contents of your post

  1. Magento needs write access to write to files/directories
  2. Which means PHP/Apache needs write access to files/directories
  3. If PHP/Apache creates a files and the web server is running under a generic apache user, then PHP/Apache should have all the access it needs.

So, when you say

there are certain files that are created by Magento that I cannot modify via FTP.

These are files and directories you don't need to worry about changing permissions for. If Apache/PHP created these files, then Apache/PHP doesn't need them to be 777 to modify them.

Files that you create "need" 777 permission so Apache/PHP can write them. Concentrate on that, and then debugging specific problems reported by Connect, and you should be good to go.

(I say "need" because brute force 777ing things still strikes me as a poor design decision, but that's a different post)

Update: Per the comment I'm about to add below, if you need to change the permissions of an Apache create folder, creating a small PHP script

<?php
    chmod('/path/to/file/or/folder', 0777);

and then running it in a web context is one way to do that.

Related Topic