Adam J
Adam J

Reputation: 508

symlink outside root directory

Ok, I am trying to create a symbolic link using php symlink() function, but am not fully understanding it. Here is what the issue is.

I have several folders on a network share that has been mounted in the following location:

/home/metaimage
/home/opmadbexports

Now, I need to symlink these inside of a drupal installation located at the following location:

/home/opmadbdev/html/

I'm unsure of how to do this. FollowSymLinks is on. I just need to code to create a symbolic link and then kill the symbolic link.

EDIT EDIT EDIT

/home/metaimage AND /home/opmadbexports

are both outside the DOCUMENT_ROOT. Not sure if that would be causing me the issues I'm having. Perhaps an alias is a better idea?

Thanks!

Upvotes: 0

Views: 1146

Answers (2)

Adam J
Adam J

Reputation: 508

Ok, I got it all figured out. While roychri was on the right track, what I ended up doing was mounting the folders inside the web root, but using .htaccess to disable php. I needed to avoid backing up all the files once they were mounted, seeing as there are a ton of files.

Once that was done, I was able to use the scripts I had previously written in order to complete the process.

Upvotes: 0

roychri
roychri

Reputation: 2936

This code should do it:

// Syntax is :  symlink ('Where the link point to',  'Name of the link to create');
symlink('/home/metaimage',         '/home/opmadbdev/html/metaimage');
symlink('/home/opmadbexports',     '/home/opmadbdev/html/opmadbexports');

// do stuff

unlink('/home/opmadbdev/html/metaimage');
unlink('/home/opmadbdev/html/opmadbexports');

Upvotes: 1

Related Questions