swethak Posted July 4, 2008 Share Posted July 4, 2008 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', ; 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] Quote Link to comment https://forums.phpfreaks.com/topic/113221-subject-failed-to-open-stream-permission-denied/ 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.