rogerbrito
asked on
readfile() on network share
Hi, I need to use the readfile function to read a file that is on a network share.
I tried everything on the php.net help page, but it still doesn't work. File_exists always returns false and the readfile function returns the following error:
-----------------
Warning: readfile(\\172.16.3.35\sto rage6\2006 -07-07\SP1 \SP1_2006- 07-07_14-0 6-39_r10.w mv) [function.readfile]: failed to open stream: Invalid argument in C:\web\websites\auditmedia 2005\_admi n\download _recorte.p hp on line 81
File not found.
-----------------
The same script can read a file on the local HD, no problems.
My network share has a permisson to Everyone (Full Control). I have some delphi applications that can read the files without problems, so I'm think the problem is a permission setting on the network share for the user that runs IIS on the webserver. Or can it be something else?
Please help!
Thank you
I tried everything on the php.net help page, but it still doesn't work. File_exists always returns false and the readfile function returns the following error:
-----------------
Warning: readfile(\\172.16.3.35\sto
File not found.
-----------------
The same script can read a file on the local HD, no problems.
My network share has a permisson to Everyone (Full Control). I have some delphi applications that can read the files without problems, so I'm think the problem is a permission setting on the network share for the user that runs IIS on the webserver. Or can it be something else?
Please help!
Thank you
ASKER
Hi RQuadling, nope, it doesn't work:
-------------------------- ---
set_time_limit(0);
readfile("\\\\172.16.3.58\ \storage2\ \2006-06-2 8\\BEL\\BE L_2006-06- 28_17-59-4 0_r15.wmv" );
Warning: readfile(\\172.16.3.58\sto rage2\2006 -06-28\BEL \BEL_2006- 06-28_17-5 9-40_r15.w mv) [function.readfile]: failed to open stream: Invalid argument in C:\web\auditmedia2005\_adm in\scripts \readfile. php on line 12
-------------------------- --
set_time_limit(0);
readfile("//172.16.3.58/st orage2/200 6-06-28/BE L/BEL_2006 -06-28_17- 59-40_r15. wmv");
Warning: readfile(//172.16.3.58/sto rage2/2006 -06-28/BEL /BEL_2006- 06-28_17-5 9-40_r15.w mv) [function.readfile]: failed to open stream: Invalid argument in C:\web\auditmedia2005\_adm in\scripts \readfile. php on line 12
-------------------------- --
Any ideas
--------------------------
set_time_limit(0);
readfile("\\\\172.16.3.58\
Warning: readfile(\\172.16.3.58\sto
--------------------------
set_time_limit(0);
readfile("//172.16.3.58/st
Warning: readfile(//172.16.3.58/sto
--------------------------
Any ideas
ASKER
I've found the answer!
It was a permission issue. I just had to create an user account on the computer that has the remote share using the same username for the Anonymous User used by IIS on the webserver. Since windows generates a random password for this user, I had to change the password and create the new account using the same user/password. Give read permission to this user on the share and it works!
Thank you RQuadling for your help.
[]s
Roger
It was a permission issue. I just had to create an user account on the computer that has the remote share using the same username for the Anonymous User used by IIS on the webserver. Since windows generates a random password for this user, I had to change the password and create the new account using the same user/password. Give read permission to this user on the share and it works!
Thank you RQuadling for your help.
[]s
Roger
That's the joy of IIS. If you are on an old version of IIS, newer versions use a different user (I believe). Even though I'm on windows, I don't use IIS as it is WAY to complex for most requirements. I use Sambar Server - free from http://www.sambar.com - with a license option if you need the enhanced functionality (I don't). Support is good too.
Can support PHP ISAPI and FastCGI. Can support PHP4 and PHP5 simultaneously with very little issue.
Can support PHP ISAPI and FastCGI. Can support PHP4 and PHP5 simultaneously with very little issue.
No objection.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As you are using \ and not /, you have to double them ...
so ...
<?php
readfile("\\172.16.3.35\st
?>
should be one of these ...
<?php
readfile("//172.16.3.35/st
?>
or
<?php
readfile("\\\\172.16.3.35\
?>
Yes. 4 backslashes.