Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    failed to open stream

    I meet with a fatal error when I am developing my website:

    failed to open stream: No such file or directory


    Details (code):
    PHP Code:
    <?php /// Moodle Configuration File

    unset($CFG);

    $CFG->dbtype = 'mysql';
    $CFG->dbhost = 'localhost';
    $CFG->dbname = 'moodle';
    $CFG->dbuser =’ ;
    $CFG->dbpass =’ ;
    $CFG->dbpersist = xxxx;
    $CFG->prefix = ‘ ';

    $CFG->wwwroot = 'http://localhost/moodle';
    $CFG->dirroot = 'D:\xampp\htdocs\moodle';
    $CFG->dataroot = 'D:\xampp/moodledata';
    $CFG->admin = 'admin';

    $CFG->directorypermissions = xxxx; // try xxxx on a server in Safe Mode

    $CFG->passwordsaltmain = &;l(~,Anx6fRxn;

    require_once("$CFG->dirroot/lib/setup.php");
    // MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
    // RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
    ?>


    Please help me to solve it, thank you!

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    what line is the error on? have to tried writing out the path to ensure that it's valid?

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Always put the full error message; it tells us what page(s), locations and stack information about its relative location.

    Without knowing what this does, the only thing that can trigger an invalid stream error here is right here:
    PHP Code:
    require_once("$CFG->dirroot/lib/setup.php"); 
    This is a simple matter of an inproper file path. Correct you're dirroot and dataroot members to point at a valid filepath location. I presumed that this is the issue since there is no indication of what in particular is triggering this error (the full error code would show that), so I have not choice but to assume that its the require_once call causing that.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    'D:\xampp/moodledata';

    That filepath is wrong

    'D:\xampp\moodledata';

  • #5
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Warning: main(D:\xampp\htdocs\moodle/lib/setup.php): failed to open stream: No such file or directory in /Users/student/ting/Sites/htdocs/moodle/config.php on line 22

    Fatal error: main(): Failed opening required 'D:\xampp\htdocs\moodle/lib/setup.php' (include_path='.:/Applications/xampp/xamppfiles/lib/php') in /Users/student/ting/Sites/htdocs/moodle/config.php on line 22

  • #6
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Warning: main(D:\xampp\htdocs\moodle/lib/setup.php): failed to open stream: No such file or directory in /Users/student/ting/Sites/htdocs/moodle/config.php on line 22

    Fatal error: main(): Failed opening required 'D:\xampp\htdocs\moodle/lib/setup.php' (include_path='.:/Applications/xampp/xamppfiles/lib/php') in /Users/student/ting/Sites/htdocs/moodle/config.php on line 22

  • #7
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <?php /// Moodle Configuration File

    unset($CFG);

    $CFG->dbtype = 'mysql';
    $CFG->dbhost = 'localhost';
    $CFG->dbname = 'moodle';
    $CFG->dbuser = 'xxx';
    $CFG->dbpass = 'ti';
    $CFG->dbpersist = false;
    $CFG->prefix = 'mdl_';

    $CFG->wwwroot = 'http://localhost/moodle';
    $CFG->dirroot = 'D:\xampp\htdocs\moodle';
    $CFG->dataroot = 'D:\xampp\moodledata';
    $CFG->admin = 'admin';

    $CFG->directorypermissions = ; // try on a server in Safe Mode

    $CFG->passwordsaltmain = '&;Zl(~,Ay9#[w[=%';

    require_once("$CFG->dirroot/lib/setup.php");
    // MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
    // RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
    ?>




    Warning: main(D:\xampp\htdocs\moodle/lib/setup.php): failed to open stream: No such file or directory in /Users/student/ting/Sites/xampp/moodle/config.php on line 22

    Fatal error: main(): Failed opening required 'D:\xampp\htdocs\moodle/lib/setup.php' (include_path='.:/Applications/xampp/xamppfiles/lib/php') in /Users/student/ting/Sites/xampp/moodle/config.php on line 22

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You don't need to keep posting the same thing >.<
    As said, the problem is you're paths; it appears that you're on a Linux system with a windows configuration.
    Change these three directives; two of which I can correct, one only you can since I have no idea what you're dns is.

    Code:
    $CFG->wwwroot = 'http://localhost/moodle';
    $CFG->dirroot = '/Users/student/ting/Sites/htdocs/moodle';
    $CFG->dataroot = '/Users/student/ting/Sites/htdocs/moodledata'; // ? no idea if this is where its located
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •