permissions? problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

permissions? problem

Post by bluesman333 »

I realize this might not even be a coding problem. I'm actually hoping it is. I'm getting an error "failed to open stream: Permission denied in....."

I'm using winxp professional. the file is read-only. as are all the files on the site. i turned off simple file-sharing and messed with the permissions, but am still having the problem.

i've been testing on a local machine. i have tried it on a shared host without problem. is it possible it could be a php.ini thing or apache setup?

Code: Select all

<?php

$dir = opendir("../../month/reports/");

while ($result = readdir($dir)) &#123;
		if ($result != "." && $result != "..") &#123; 
			print '<b>' . $result . '</b><br>';
		&#125;
		
$fp = fopen("../../month/reports/" . $result, 'r') or die ("Could not open file");
		while ( ! feof($fp) ) &#123;
			$line = fgets( $fp, 2048);	
		&#125;
&#125;			
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is safe_mode on? What about open_basedir?
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

still not working

Post by bluesman333 »

safe_mode is off and open_basedir set to 0. I also tried it with no value.

when i set open_basedir to 1 i get an error that it was restriceted due to open_basedir being set.

that leads me to believe that fopen is at least attempting to open the file at 0 but not at 1
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

so the data is above your document root.. It sounds like your install of PHP likely doesn't have read access to those directories.
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

Post by bluesman333 »

how do i give it access?
Post Reply