开发者

Magento Connect FTP Settings

When I am configuring the settings for Magento Connect I get the following error:

    Deployment FTP Error. Local file doesn't exist:
    Settings has not been loaded.开发者_开发知识库 Used default settings
    Config file does not exists please save Settings

The details I use are:

ftp.mysite.com.au
myftpusername
myftppassword
install path: public/www/shop (advise by web host to use this)

Magento sits in a folder called /shop

Any help. I have looked on this site and the Magento forums and have not found a solution.


Set the chmod of the "downloader" directory temporary to 777 (and revert it back afterwards), so that magento-connect can write the connect.cfg file.


Might not have anything do to with it but I found deleting the connect.cfg file when it's troublesome or connect manager wont change the settings.


Are you on shared hosting by any chance? If so, this may help you.

I've just spent most of a day messing around with Magento Connect Manager 2.0 trying to get it working with the FTP option. I couldn't even get it to save any of my settings on the settings tab, it just kept reverting to the defaults.

I eventually tracked the problem down to Magento's insistence on using sys_get_temp_dir to determine the temporary directory. This doesn't generally work on shared hosting, since you won't have write access to /tmp. Unfortunately, there's no errors generated when it fails, and Magento just carries on but doesn't save or load the Magento Connect FTP settings. I had a similar problem elsewhere in the core code before.

I've created a temporary folder under my main installation at /var/tmp, and made it world-writable.

There's 11 places within /downloader and /lib/Mage which use this function to determine the temporary folder. These will need to be changed to point at wherever you decide to put your temp folder. I'm not sure if all of them need to be changed, or exactly what they all do, but I changed them to be on the safe side. Details at the end of the post. Line number are approximate, but just search for sys_get_temp_dir in each file.

Once you've made the changes you'll need to ensure that the following folders are world writable, recursively:

/var/package/tmp/
/downloader/.cache
/media

The plus side of the FTP option is that the Magento root no longer needs to be writable.

Any of the changes below may break Magento Connect, particularly the ones marked with **. I've done them , and run one install of a module which seemed to go OK, but I make no guarantees about them. They're also a bit messy in some places, I'm sure they could be improved - there may be a better way of getting magento_root in some cases. Be careful, there are similarly named files in different subfolders.

Still, hope they might save someone going through the nuisance I had today. Would be a great help if Varien would just write their own tmpDir function and let you specify a temp folder in the admin, save a ton of hassle. Ah well.

downloader\lib\Mage\Connect\Config.php, line 207:

//  $tempFile = tempnam(sys_get_temp_dir(),'config');
$tempFile = tempnam($this->magento_root. '/var/tmp/' ,'config');

downloader\lib\Mage\Connect\Command\Registry.php, line 315:

//$localXml = tempnam(sys_get_temp_dir(),'package');
$magento_root =  dirname(dirname(__FILE__)) . '/../../../..';
$localXml = tempnam($magento_root. '/var/tmp/' ,'package'); 

downloader\lib\Mage\Connect\Loader\Ftp.php, line 107:

//   $tmpDir = sys_get_temp_dir();
$magento_root =  dirname(dirname(__FILE__)) . '/../../../..';
$tmpDir = $magento_root . '/var/tmp/';

downloader\Maged\Controller.php, 869**:

//$tempFile = tempnam(sys_get_temp_dir(),'maintenance');
$tempFile = tempnam($config->__get('magento_root') . '/var/tmp/' ,'maintenance'); 

This one is needed in order to save your config changes: downloader\Maged\Model\Connect.php, 404:

//$tempFile = tempnam(sys_get_temp_dir(),'config');
$tempFile = tempnam($configObj->magento_root. '/var/tmp/' ,'config');

downloader\Maged\Model\Config\Abstract.php, 88**:

//  $tempFile = tempnam(sys_get_temp_dir(),'configini');
$magento_root =  dirname(dirname(__FILE__)) . '/../../..';  
$tempFile = tempnam($magento_root. '/var/tmp/' ,'configini');

downloader\lib\Mage\Connect\Packager.php - the remaining 5 changes are in this file.

Line 96 - I believe this was the one needed to load your config changes onto the settings screen:

// $tempConfigFile = tempnam(sys_get_temp_dir(),'conf');
$magento_root =  dirname(dirname(__FILE__)) . '/../../..';
$tempConfigFile = tempnam($magento_root . '/var/tmp/' ,'conf');

line 111:

// $tempCacheFile = tempnam(sys_get_temp_dir(),'cache');
$magento_root =  dirname(dirname(__FILE__)) . '/../../..';
$tempCacheFile = tempnam($magento_root . '/var/tmp/' ,'cache');

Around 135, before the if statement:

$magento_root =  dirname(dirname(__FILE__)) . '/../../..';

then in both the if and the else parts:

//  $configFile=tempnam(sys_get_temp_dir(),'conf');
$configFile = tempnam($magento_root. '/var/tmp/' ,'conf');

158:

//$tempConfigFile = tempnam(sys_get_temp_dir(),'conf_');
$magento_root =  dirname(dirname(__FILE__)) . '/../../..';
$tempConfigFile = tempnam($magento_root. '/var/tmp/' ,'conf_');


This error is displayed because the tool could not save your settings in the "connect.cfg".

To resolve this problem, first change the permission to 666 connect.cfg file "lying in the directory. / Downloader Magento. Soon after, visit Magento Connect and select the tab" Settings ". Finally, just click "Save Settings".


If you access Magento Connect and it’s telling you to check the write permissions, there’s a simple way to fix this.

Open up your SSH client and go to the directory where Magento is installed. Once you are there, copy and paste the following command:

find . -type d -exec chmod 777 {} ;

If you are on a cPanel server you need to do this:

find . -type f -exec chmod 755 {} ;

(or just go to your file manager and choose 755)

Your Magneto site on cpanel will not work with permissions set to 777! That will change the permissions on all the directories to writable, and you should be able to use Magento Connect now.

You may also need to change the permissions on the pear download file to be able to properly install Magento Connect packages:

chmod 777 downloader/pearlib/download/package.xml
Magento Connect write permissions error 

After you’ve done what you’ve need to do in Magento Connect, reset your permissions.

NOTE: You will typically see this error in hosting environments where PHP is running as an Apache module (mod_php, DSO). That means, when you try to use Magento Connect, it’s going to run as user nobody instead of your username. You must use SSH to upgrade Magento.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜