Magento Connect FTP设置

5

当我配置Magento Connect的设置时,出现以下错误:

    Deployment FTP Error. Local file doesn't exist:
    Settings has not been loaded. Used default settings
    Config file does not exists please save Settings

我使用的细节如下:

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

Magento的安装目录为/shop。

需要帮助吗?我已经查看了这个网站和Magento论坛,但没有找到解决方案。

5个回答

7
将“downloader”目录的chmod暂时设置为777(然后在之后恢复),这样magento-connect就可以编写connect.cfg文件。

5

也许这与此无关,但我发现当连接管理器出现问题或无法更改设置时,删除connect.cfg文件可以解决问题。


+1 connect.cfg 文件包含了一个无效的硬编码路径。 - snez

4

你是否在使用共享主机?如果是,这可能会对你有所帮助。

我花了大部分时间来解决Magento Connect Manager 2.0与FTP选项配合使用的问题。我甚至无法保存任何设置,因为它总是恢复到默认值。

最终,我发现了问题所在:Magento坚持使用sys_get_temp_dir来确定临时目录。这通常在共享主机上不起作用,因为你无法写入/tmp。不幸的是,当它失败时没有生成任何错误,Magento只是继续运行但不保存或加载Magento Connect FTP设置。我以前在核心代码中也遇到过类似的问题。

我在我的主安装目录下创建了一个临时文件夹/var/tmp,并使其可写。

/downloader和/lib/Mage中有11个地方使用此函数来确定临时文件夹。这些需要更改为指向你决定放置临时文件夹的位置。我不确定是否需要更改所有这些位置,或者它们的确切作用,但我为了保险起见将它们全部更改了。详细信息请参见文章末尾。行号是近似值,但只需在每个文件中搜索sys_get_temp_dir即可。

一旦你做出了更改,你需要确保以下文件夹递归地可写:

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

FTP选项的优点是Magento根目录不再需要可写权限。
以下任何更改都可能破坏Magento Connect,特别是标有**的更改。我已经进行了更改,并运行了一个模块的安装,似乎没问题,但我不能保证它们的有效性。有些地方也有点混乱,我相信它们可以改进 - 在某些情况下可能有更好的方法来获取magento_root。请小心,不同子文件夹中有类似命名的文件。
尽管如此,希望这些更改能够帮助避免今天我所遇到的麻烦。如果Varien只是编写自己的tmpDir函数并让您在管理员中指定临时文件夹,那将会非常有帮助,可以省去很多麻烦。唉。 downloader\lib\Mage\Connect\Config.php,第207行:
//  $tempFile = tempnam(sys_get_temp_dir(),'config');
$tempFile = tempnam($this->magento_root. '/var/tmp/' ,'config');

downloader\lib\Mage\Connect\Command\Registry.php,第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,第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'); 

为了保存您的配置更改,需要这个文件: 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 - 这个文件里还需要进行5项修改。

第96行 - 我认为这是需要将您的配置更改加载到设置屏幕上的行:

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

第111行:

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

在 if 语句之前的大约 135 行处:
$magento_root =  dirname(dirname(__FILE__)) . '/../../..';

然后在if和else两个部分中:

//  $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_');

0
如果您访问Magento Connect并提示您检查写入权限,有一种简单的解决方法。
打开SSH客户端并转到安装Magento的目录。一旦你到达那里,复制并粘贴以下命令:
find . -type d -exec chmod 777 {} ;

如果您正在使用cPanel服务器,您需要执行以下操作:
find . -type f -exec chmod 755 {} ;

(或者只需打开文件管理器并选择755)

你的cpanel上的Magneto网站不会在权限设置为777时工作!那会将所有目录的权限更改为可写,然后您应该能够使用Magento Connect。

您可能还需要更改pear下载文件的权限,以便能够正确安装Magento Connect包:

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

在完成Magento Connect中需要做的事情后,请重置您的权限。

注意:通常在PHP作为Apache模块(mod_php,DSO)运行的托管环境中会看到此错误。这意味着,当您尝试使用Magento Connect时,它将以用户nobody而不是您的用户名运行。您必须使用SSH升级Magento。


0

显示此错误是因为该工具无法保存您在“connect.cfg”中的设置。

要解决此问题,首先将权限更改为666,然后在目录“/ Downloader Magento”中找到connect.cfg文件。接下来,访问Magento Connect,并选择“设置”选项卡。最后,只需单击“保存设置”即可。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接