简体   繁体   English

根目录外部的符号链接

[英]symlink outside root directory

Ok, I am trying to create a symbolic link using php symlink() function, but am not fully understanding it. 好的,我试图使用php symlink()函数创建一个符号链接,但是并没有完全理解它。 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: 现在,我需要在以下位置的drupal安装内部将它们符号链接:

/home/opmadbdev/html/

I'm unsure of how to do this. 我不确定如何执行此操作。 FollowSymLinks is on. FollowSymLinks已打开。 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. 都在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. 当roychri步入正轨时,我最终要做的是将文件夹安装在网络根目录中,但是使用.htaccess禁用了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. 完成此操作后,我便可以使用以前编写的脚本来完成该过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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