PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
VFS Virtual File System - failed to open stream

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> File System
View previous topic :: View next topic  
Author Message
encolpio



Joined: 24 Jan 2007
Posts: 1

PostPosted: Wed Jan 24, 2007 6:14 am    Post subject: VFS Virtual File System - failed to open stream Reply with quote

Hi, I'm trying to use VFS, and have this problem:

Quote:
Warning: file_get_contents(/home/mario/Desktop/prueba.txt) [function.file-get-contents]: failed to open stream: Permission denied in /usr/share/php/VFS/sql_file.php on line 72

Here is the code of /usr/share/php/VFS/sql_file.php:

Code:
    function read($path, $name)
    {
        $conn = $this->_connect();
        if (is_a($conn, 'PEAR_Error')) {
            return $conn;
        }

        $file = $this->_getNativePath($path, $name);

        if (function_exists('file_get_contents')) {
            $data = file_get_contents($file);                       //this is line 72 in that file
        } else {
            $fp = @fopen($file, 'rb');
            if (!$fp) {
                return PEAR::raiseError(_("Unable to open VFS file."));
            }
            $data = fread($fp, filesize($file));
            fclose($fp);
        }

        return $data;
    }


I used data/vfs.sql to create the "vfs" table in the "vfs" database in mysql.
I can see I have a problem with permissions but don't know how to work it out.
The file I want to read is "/home/mario/Desktop/prueba.txt", and my code is:

Code:
<?php

require_once('HTML/Template/Sigma.php');
require_once('VFS.php');
require_once('VFS/sql_file.php');

$array = array(phptype => 'mysql',
               vfsroot => '',
               table => 'vfs',
               hostspec => 'localhost',
               database => 'vfs',
               username => 'mario',
               password => '',
);

$vfs = new VFS_sql_file($array);

    $vfs->_permissions = array(
        'owner' => array('read' => true, 'write' => true, 'execute' => true),
        'group' => array('read' => true, 'write' => true, 'execute' => true),
        'all'   => array('read' => true, 'write' => true, 'execute' => true));

$res = $vfs->read('/home/mario/Desktop/', 'prueba.txt');
echo "Resultado: " . $res;

?>


Any idea?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> File System All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement