Magento and safe mode

The e-commerce application magento, for some reason, expects to have a lot of permissions on every server. One thing I stumbled upon when trying to install magento, was the creation of /tmp/magento/var.

Since /tmp could be shared between all users, this may not be the safest way. That's why my servers don't allow access to /tmp, but have a personal /tmp-style directory instead.

I got the error:
[Thu Feb 04 21:24:21 2010] [error] [client 1.2.3.4] PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/tmp/magento/var) is not within the allowed path(s): (/blah/blah/website.com:/usr/share/pear:/var/www/error) in /blah/blah/website.com/app/code/core/Mage/Core/Model/Config/Options.php on line 214

The fix is very, very easy. But since I couldn't find anyone else posting the exact fix, I thought I'd do it.

in app/code/core/Mage/Core/Model/Config/Options.php on line 137, you find:

    public function getSysTmpDir()
    {
        return sys_get_temp_dir();
    }

Change it to:

public function getSysTmpDir()
    {
        return $_SERVER['DOCUMENT_ROOT'].'/your_secret_tmp_dir/';
    }

© GeekLabInfo Magento and safe mode is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3,00 out of 5)
Loading...

5 thoughts on “Magento and safe mode

  1. echostretch

    I ´m with similiar problem but i can t fix it. can you geekLab?

    Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/lib/php//Mage/Page/Block/Html/Wrapper.php) is not within the allowed path(s): (/home/newsecurityshop/:/usr/share/pear/:/var/lib/php/:/tmp/) in /home/newsecurityshop/www/newsecurity/app/code/core/Mage/Core/functions.php on line 145

    Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/lib/php//Mage/Catalog/Block/Product/Price/Template.php) is not within the allowed path(s): (/home/newsecurityshop/:/usr/share/pear/:/var/lib/php/:/tmp/) in /home/newsecurityshop/www/newsecurity/app/code/core/Mage/Core/functions.php on line 145

  2. sathish

    Fatal error: Call to a member function getModelInstance() on a non-object in /usr/local/pem/vhosts/111027/webspace/httpdocs/staging/app/Mage.php on line 432. still i got this error. can anyone help me!

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

*

code