Jump to content

Subject: failed to open stream: Permission denied


swethak

Recommended Posts

Hi,

 

when i run my code it gives error as

 

fopen(lib/providers//provider.RVLogic.php): failed to open stream: Permission denied in F:\Facebook\furniture11\Data Mining\public_html\lib\inc\functions.lib.php

 

Line 673 : trigger_error("Failed to open stream to $filename. Permission denied!", E_USER_ERROR);

 

could you plz tell the solution for how to avoid that errors

 

 

// Define Needed Function

if(!function_exists('file_put_contents'))

{

if (!defined('FILE_USE_INCLUDE_PATH'))

define('FILE_USE_INCLUDE_PATH', 1);

 

if (!defined('LOCK_EX'))

define('LOCK_EX', 2);

 

if (!defined('FILE_APPEND'))

define('FILE_APPEND', 8);

 

function file_put_contents($filename, $data, $flags = NULL)

{

//if(!file_exists($filename)) trigger_error("File $filename doesn't exist!", E_USER_ERROR);

 

if(!isset($data)) trigger_error("No value provided for required parameter \$data!", E_USER_ERROR);

 

if(empty($data) && $data != 0) trigger_error("Empty value passed for parameter \$data!", E_USER_ERROR);

 

if (FALSE === ($fp = @fopen($filename, $flags & FILE_APPEND ? 'a' : 'wb', $flags & FILE_USE_INCLUDE_PATH)))

{

trigger_error("Failed to open stream to $filename. Permission denied!", E_USER_ERROR);

return FALSE;

}

 

if ($flags & LOCK_EX)

if (!flock($fp, LOCK_EX))

trigger_error("Exclusive lock to $file was not obtained!", E_USER_WARNING);

 

$length = strlen($data);

$bytes = 0;

 

if (FALSE === ($bytes = @fwrite($fp, $data)))

{

trigger_error("Failed to write $length bytes to $filename!", E_USER_ERROR);

return FALSE;

}

 

fclose($fp);

 

if($bytes != $length)

{

trigger_error("Only $bytes of $length bytes were written to $filename! Possibly out of disk space.", E_USER_WARNING);

return FALSE;

}

 

return $bytes;

}

}

 

[code=php:0]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.