Magento and safe mode

4 Feb 2010 by David (admin)
Tags: , , , ,
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

Was this page useful?

Please rate this page and/or leave a comment.
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.00 out of 5)
Loading ... Loading ...

3 Comments

  1. mooiness says:

    Awesome tip. You are right about Magento expecting full permissions to everything. :)

  2. echostretch says:

    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

  3. sathish says:

    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!

Leave a Reply

Pages

Search

Tags

3com 4250T 5216k access point acpi Acrobat Active Directory AD ad-hoc wifi Adobe Apache Asterisk Asterisk 1.8 autorepair backdoor barcode bash bat batch Belkin bios bootloader CentOS CentOS 5 CentOS 6 certificates checksum cmos console access cookies CUPS database databases Dead default password Dell dhcp digital invoice dns dnsmasq dovecot Dymo dynamic dns dyndns e-commerce EAN13 Esx Esx4 Exchange Exchange 2007 fax Fedora Fedora 13 Fedora 15 Fedora 16 Firefox firewall firmware fix FoIP fonts ftp fuckup ghostscript Google Google apps Google Chrome Google Maps Google Talk GPO grub gvfs-open H200 hibernation http hushlogin initrd internet explorer iproute2 iptables IPv6 jQuery KB953297 KB974417 KBsomething KDE Konsole layer8 LDAP ldifde Linux login Lovelock lpd magento mkinitrd mplayer ms office ms office 2010 mysql Nagios networking NetworkManager NoteToSelf NTLM nullmodem nvram Omniview OpenSSL openvpn password patch pcl pdf PERC PHP Postfix PostScript preload printer privacy proxy pstn pureftpd pxe rant reboot RedHat remote remote wipe reset password Review root root access route router rpm Samba Samsung Galaxy S2 scripting securit security SELinux Sendmail SEO Servicetag shutdown SMTP socat software deployment Spam speed-up SQL Server Express squid ssh SSL starttls stupid switch sysinternals syslinux talk tftp thawte Thunderbird Trend Micro updates v4l v4l2 vdr viclient video VMWare VMWare Data Recovery vnc voice voip vpn vSphere vsphere client wbinfo webapps webcam wf.msc wifi winbind Windows Windows 7 Windows 2003 Windows 2008 SBS windows internal database Windows Updates Windows XP wmic WordPress WordPress plugins wscript WSUS wsusutil WYukon