Jump to content

fopen and open_basedir


wright67uk

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.