简体   繁体   中英

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!

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');

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM