Reiskeks Posted July 28, 2015 Share Posted July 28, 2015 Hello people, i really need help.. Im programming an intranet for my employer and now i face a problem. The server runs on Windows 2008 R2, the website is online and PHP works and also my sql database. Now my employer wants me to put links online which lead to a network location. Everybody has access to this server but i cant figure out how to write the php code to point to that direction. The Website runs on the server DERFPFVM072 and the files to download are on the server DERFNAP001/all.rb. I tried chdir but it doesnt work, i tried normal html but it didnt work. Is there a way to make the files downloadable without moving them to the server? Note: Moving the files to the server would have been my suggestion but this would lead to a lot of work to change the licenses (the company i work for has A LOT OF LICENSE FOR EVERY LITTLTE THING) to let the employees have access to the shared folder on the server. Apparently, this is what my code looks like: <?php error_reporting(E_ALL); $dir = opendir("//DERFPFNAP001/all.rb/Useranleitungen"); while (($file = readdir($dir)) !== false) { echo '<li><a href="//DERFPFNAP001/all.rb/Useranleitungen/'.$file.' " type="video/mp4">'.$file.'</a></li>'; } closedir ($dir); ?> </ul> Im pretty new to working with php and have never done something like that before. When the files are on the server the download work with: <?php chdir('./howtos'); foreach(glob('*') as $key => $file) { echo '<li><a href="/intranet_data/abteilungen/it/howtos/'.$file.'">'.$file.'</a></li>'; } ?> Thanks for your help beforehands Quote Link to comment Share on other sites More sharing options...
requinix Posted July 28, 2015 Share Posted July 28, 2015 If you're using IIS then its user needs to have permissions to access that server and list the files in that share/directory. Ask your network administrator to set that up for you. Quote Link to comment Share on other sites More sharing options...
Reiskeks Posted July 28, 2015 Author Share Posted July 28, 2015 It is set up. When the site loads it doesnt show a error message or somethin glike that. it just loads endlessly and doesnt show any files >_< Quote Link to comment Share on other sites More sharing options...
requinix Posted July 28, 2015 Share Posted July 28, 2015 Right, I forgot to ask what "doesn't work" means... There's nothing in your code that would cause random slowdowns (that aren't related to network problems). Is there more code? Have you figured out where in the code the slowdown is? Quote Link to comment Share on other sites More sharing options...
Reiskeks Posted July 30, 2015 Author Share Posted July 30, 2015 It doesnt show the files. There is no content. I mapped the network location in the server as a admin and have full right to the mapped locations. <?php chdrive ("Z:"); chdir("./Vorlagen"); echo getcwd(); foreach(glob('*') as $key => $file) { echo '<li><a href="Z:/Vorlagen/'.$file.'" download="Z:/Vorlagen/'.$file.'">'.$file.'</a></li>'; } ?> I want to provide the files for the emloyees to download them. Is there something in my code thats wrong? Further Info: I mapped the Folder "Vorlagen" directly and the mapped Network Location hat the letter "Z" on my server. The files are lying on a NetAPP Storage (NDMP) On the Storage the structure to the files is: "DERFPFNAP001/all.rb/Vorlagen/$files" Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted July 30, 2015 Solution Share Posted July 30, 2015 (edited) 1. Mapping the location to a drive will not affect permissions. 2. You can only link people to Z: if everybody has that location mounted as that drive letter. Skip the chdrive (which doesn't even exist), skip the chdir, and give glob() the full path. <?php foreach(glob('//DERFPFNAP001/all.rb/Vorlagen/*') as $key => $file) { echo '<li><a href="Z:/Vorlagen/'.$file.'" download="Z:/Vorlagen/'.$file.'">'.$file.'</a></li>'; } ?>Are you saying that does not output anything? Are you running this from CLI (to test with) or from the server? Try running it the other way to see if there's a difference. And I'll say it again because 99% it's the cause of this problem: the \\DERFPFNAP001\all.rb share and the all.rb\Vorlagen file permissions are definitely allowing your IIS to connect? As in when you check the permissions you see an entry for IUSR or IUSR_something*, and that entry grants read and list permissions? Also, I tend to assume people have their PHP error settings set to something useful, but that's not always the case. Do you have error_reporting = -1 display_errors = onin your php.ini? If not, set them, restart the IIS application pool, and see if there are any errors or warnings on that one page. * I think it's IUSR_machine_name. Others groups may work too, like Everyone or Authenticated Users. Edited July 30, 2015 by requinix Quote Link to comment Share on other sites More sharing options...
Reiskeks Posted July 31, 2015 Author Share Posted July 31, 2015 It works now, thanks. Because the company i work for is part of a bigger one, the headquarter has all the IUSR'S. I added a administration User in the IIS and now it works. The only thing left is to make the files downloadable ^^ Thanks fpr your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.