homepage Welcome to WebmasterWorld Guest from 50.17.177.99
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
accessing files on remote share
ahmed24




msg:4036259
 4:15 pm on Dec 3, 2009 (gmt 0)

I have a web server running Apache with PHP5 and on the same network i have a file-server which has some files. can anyone tell me how i can use php that is on the webserver to access the files on a share on the fileserver like this: \\file-server\myfiles$

The problem i face is that these shares are restricted to users and therefore need to know how the PHP can parse user information to the server to access these files?

any help would be great.

thanks

 

CyBerAliEn




msg:4036283
 4:29 pm on Dec 3, 2009 (gmt 0)

I'm not sure how to do this with strictly PHP (I am doubtful it is possible).

But, a general solution... Mount the file server location you want to use (say /root/myfiles/ on the file server), to place on the web server (say /root/htdocs/myfiles/ on the web server). Doing this, any "regular" access to that spot on the web server will automatically retrieve the files off the file server.

I know this approach is possible because system administrators at my work often employ this strategy. Our satellite beams gigabytes of data to our center every day and is stored on a series of remotely connected file servers. For some web tools we use that I have developed (that require those files), our system admins simply mounted the location of the files (from the file server) to a spot on the internal web server, thus giving it access. Then, any link/PHP action/etc to this web server location will yield the file server contents.

If this was a location on the same server (outside the web root), I believe you could use Apache to "map" the location. However, given the stuff you want is on another server, I believe this goes beyond just Apache/PHP and would require the mounting via the OS. Hopefully this guides you in the right direction.

EDIT: Re-reading your question, it seems like your "user" criteria complicates the matter considerably. I am guessing depending on the user working, the mounted file location points to a different spot on the file server; but the user working always accesses the mounted file share? Kind of like the user accessing '/myfiles/' (on user computer) is routed to '/root/userABC/files/' (on file server) [for example]? If this is about the case... you would still need to follow my mounting advice to make the files available to Apache/PHP [mount location on file server, to a location on the web server so PHP/etc has access to it]. The problem is, if the file location is dependent on the user, this complicates the matter, because you can't just mount the file location without knowing the user. Am I ~about understanding your situation correctly?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved