wright67uk Posted April 10, 2011 Share Posted April 10, 2011 Ive just tried to use fopen for the first time, but ive been denied access. Im trying to create a new page. $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Restaurant' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value){ $i++; echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".html'>" . $nt[$i] . "</a>" . "<br/>";} $FileName = str_replace(' ','_',$nt[$i]) . ".html"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); fclose($FileHandle); Warning: fopen(Indian.html) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\######\html\1pw\b.php on line 40 cant open file. The hosting company I use say in their help forum; "If a file is outside of the paths defined by open_basedir, PHP will refuse to open it" Is there a query I can run to find out which paths are defined by open_basedir and is it possible to edit open_basedir? Quote Link to comment https://forums.phpfreaks.com/topic/233277-fopen-and-open_basedir/ Share on other sites More sharing options...
Zurev Posted April 10, 2011 Share Posted April 10, 2011 I'm going to assume it's more of a permissions issue. To rule it out, CHMOD the file you're trying to open to 777 and then retry, if it still doesn't work then we'll have to figure it out from there. Though if the file is in the same path as the php script, then it is not outside of the path. Quote Link to comment https://forums.phpfreaks.com/topic/233277-fopen-and-open_basedir/#findComment-1199695 Share on other sites More sharing options...
dcro2 Posted April 10, 2011 Share Posted April 10, 2011 Try: echo ini_get("open_basedir"); to check the setting. Quote Link to comment https://forums.phpfreaks.com/topic/233277-fopen-and-open_basedir/#findComment-1199737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.