954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

fopen problem

Hi,

For some reason I can't make fopen work. It worked fine on my server, however upon putting the script on my clients server it started giving this error:

Warning: fopen(test.jpg) [function.fopen]: failed to open stream: Permission denied in <long path> on line 5

From this call:

$File = "test.jpg";
$Handle = fopen($File, 'wb');

According to phpinfo() the server is:
Windows NT B-SERVER-01 5.2 build 3790
PHP Version 4.4.7
And safe mode is off if it makes a difference.

I assume that its something to do with permissions but how do I go about fixing it. I don't really do a lot of php development only small things like this script

darkmikey
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 1
 

Yes, it is a permission problem. You need to chmod the the in question.

http://en.wikipedia.org/wiki/Chmod

Or if the problem is ownership, chwon:

http://en.wikipedia.org/wiki/Chown

digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 

I was under the impression that Chmod and Chown are unix system commands, and that windows does not have them?

darkmikey
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 1
 
I was under the impression that Chmod and Chown are unix system commands, and that windows does not have them?

Usually, it isn't a problem on windows.

Which version of windows?

Make sure the file is not set to read only, or being used by another process (program).

eg: Right click, properties.

Vista has group access control to files similar to unix. Make sure the PHP user can access that file. I don't have much experience with this however.

digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 

First of all, you please check your file path that need to open and your access permissions from client side. Then only, it will perfectly works

Dragonbaki
Junior Poster
130 posts since Oct 2010
Reputation Points: 15
Solved Threads: 21
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You