Re: Displaying files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 Aug 2008, at 13:37, Dan Shirah wrote:
If the network resource is the only location where these files exist, what
do you suggest I do?

Use PHP to first copy() the file from the server to a temp directory on my
web server and then open the document from the temp dir?

PHP cannot access the file because the user it's running as has no network access. It has nothing to do with the method you use to access the file in PHP so copy will not work either.

If that other server is publicly accessible your best bet is to serve the file directly on that server - i.e. do an HTTP redirect to that file on the other server. If not then you're left with enabling network access for the PHP user. A quick Google got me this: http://support.microsoft.com/kb/207671 but there are other references out there.

-Stut

On 8/14/08, Boyd, Todd M. <tmboyd1@xxxxxxxx> wrote:

-----Original Message-----
From: Stut [mailto:stuttle@xxxxxxxxx]
Sent: Thursday, August 14, 2008 4:34 PM
To: Boyd, Todd M.
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Displaying files

On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote:

-----Original Message-----
From: Stut [mailto:stuttle@xxxxxxxxx]
Sent: Thursday, August 14, 2008 4:21 PM
To: Dan Shirah
Cc: PHP-General List
Subject: Re:  Displaying files

On 14 Aug 2008, at 21:57, Dan Shirah wrote:
That simply means it can't open the file. Make sure the machine
this
is running on has everything it needs to access that UNC filename.

-Stut


Stut,

If I copy the link from the error message and paste it into a
browser running from my PHP server, the file comes up just fine.

Should I try mkdir() or mkpath() to set the server and folder
location and then try it from there?

The user PHP runs as needs to be able to access it, not you. I'm
guessing you're on Windows...

If you're using IIS then it's the IUSR_machine user which doesn't
have
access to the network by default. You can enable it but I can't
recall
how off the top of my head and you may want to reconsider because
it
leaves the server a lot more open should IIS/PHP/else be
compromised.

If you're using Apache on Windows then you'll need to check the
service configuration to see what user it's running as.

It can be done somewhat securely by mapping a network drive and then
granting permissions to it specifically, rather than the network
itself.
(I believe...)

It's been a while since I've used Windows but IIRC you need to enable network access for that user at the lowest layer (i.e. system policy)
and then normal access rules apply, but I could be wrong. Either way
I'd avoid doing it if at all possible.

I think after XP SP2 it got a bit more granular. However, I'm no MCSE, so don't take my word for it. :) I do agree with you, anyway, that the
user a webserver is posing as should not have access to network
resources like this.

I digress.


Todd Boyd
Web Programmer




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux