|
Alright so I did a little digging around to see what I could figure out. If someone more familiar with PHP and/or web servers could pipe in with some explanations to fill in the holes I’d much appreciate it.
Fortunately when things go awry you get a nice neat call stack. I dug around and used one of the oldest tricks in the book… I put a bunch of print statements all over the code following the call stack that I had from the error that was being reported. Now I can’t imagine how checking to see if the string “/home” is a directory or not would cause a security breach, but apparently open_basedir just won’t let you do anything with it at all.
For some reason (which may make perfect sense to a PHP coder) a function (_createDestinationFolder) in lib/varien/io/file.php takes the path that is passed into the open command and tries to take it apart then put it back together again bit by bit. Like I said I don’t get why but this is what it is doing. So A path like /home/my_dir/public_html/my_magento_dir/var/export is ripped into and array (home, my_dir,public_html,my_magento_dir,var,export) and then it rebuilds the path starting with the string “/” and tacking on each piece of the array until it can actually open the directory or make the directory it needs. It all seems rather silly. The problem is that the /home directory is typically not open to the general public on a server. The lowest level directory open to a user on the server is /home/my_dir.
So I added a check to see if we are trying to take a peek at /home. If we are I simply tell the code to move along nothing to see here and try again. Since the next loop slaps on the my_dir to the /home, making /home/my_dir we are back to a happy place (at least on my server) and we can continue.
Add this code around line 442 in the function _createDestinationFolder in the file lib/varien/io/file.php:
if($newPath === "/home") { $oldPath = $newPath; continue; }
That allowed me to export products and customers. It’s late again and I’m going to bed. I’ll tackle import tomorrow. Hope this info helps someone.
MunchyMonster
|