Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

QuickFix Magento 1.7.0.0 in CPanel Shared Host
 
mcslohmann
Jr. Member
 
Total Posts:  1
Joined:  2012-07-03
 

Installing Magento in a shared host may rise an error trying to determine the temp dir when sessions or uploads are needed.
A quick fix is to add a few lines in magento/lib/Zend/Cache/Backend.php as follows:

(line 152)

public function getTmpDir()
    
{
        $tmpdir 
= array();
        foreach (array(
$_ENV$_SERVER) as $tab{
            
foreach (array('TMPDIR''TEMP''TMP''windir''SystemRoot') as $key{
                
if (isset($tab[$key])) {
                    
if (($key == 'windir') or ($key == 'SystemRoot')) {
                        $dir 
realpath($tab[$key] '\\temp');
                    
else {
                        $dir 
realpath($tab[$key]);
                    
}
                    
if ($this->_isGoodTmpDir($dir)) {
                        
return $dir;
                    
}
                }
            }
        }

        
/* FIX FOR USE IN SHARED HOSTS LIKE CPANEL */
        
$cdir realpath('.');
        
$path explode('/',$cdir);
        
$dir '/'.$path[1].'/'.$path[2].'/tmp';
        if (
$this->_isGoodTmpDir($dir)) {
            
return $dir;
        
}

        $upload 
ini_get('upload_tmp_dir');
        if (
$upload{
            $dir 
realpath($upload);
            if (
$this->_isGoodTmpDir($dir)) {
                
return $dir;
            
}
        }
(...)
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top