views:

41

answers:

2

I'm having this weird thing happen. My Zend Framework (PHP) web application that I have been developing locally works fine on my computer, but once it's uploaded to the server, it thinks that the uploads directory doesn't exist.

My application has an uploads directory which is a symlink to a directory outside of the application:

#local
/myapp.local
    /application
    /data
        /uploads (symlink, points to ./../../shared_uploads)
    /public/index.php
/shared_uploads

#remote
/shared_uploads
/current (symlink, points to ./releases/myapp-2009-12-18)
/releases
    /myapp-2009-12-18
        /application
        /data
            /uploads
        /public/index.php

The server points to /current/public/index.php to serve up the application. Could it be that since it is actually in the releases directory that it's one level deeper? Or could it be a permissions error since I created the uploads symlink on my local computer instead of on the server?

Update: In my /public/index.php file I'm defining my upload dir like this:

// Define path to uploads directory
defined('APPLICATION_UPLOADS_DIR')
    || define('APPLICATION_UPLOADS_DIR', realpath(dirname(__FILE__) . '/../data/uploads'));
+1  A: 

The permissions shouldnt be an issue so long as your UMASK is 0022 but the question is how are you uploading? FTP isnt going to respect a symlink (though i beleive sftp does) while scp or rsync will.

Whit that said though its definitely your directory structure nesting. the symlink is should be relative from the true location of its parent so in your case thats going to be ln -s ../../../../shared_uploads. i think the easiest solution here would be to make a symlink within releases to refer to the real shared_uploads.

prodigitalson
I added the symlink in releases, and that did the trick! thanks!
Andrew
A: 

Does this help?

defined('APPLICATION_UPLOADS_DIR') || define('APPLICATION_UPLOADS_DIR', dirname(dirname(realpath(__FILE__))) . '/data/uploads');

I removed the .. by using two dirname()s and I ran realpath() earlier to remove the symlink from the path.

Though I suspect you don't need the realpath() at all.

Ciao!

The Doctor What