...

View Full Version : failed to open stream



kcting
03-26-2010, 06:18 PM
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!

angst
03-26-2010, 06:23 PM
what line is the error on? have to tried writing out the path to ensure that it's valid?

Fou-Lu
03-26-2010, 06:35 PM
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:


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.

Nightfire
03-26-2010, 06:42 PM
'D:\xampp/moodledata';

That filepath is wrong

'D:\xampp\moodledata';

kcting
03-27-2010, 05:37 AM
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

kcting
03-27-2010, 06:06 AM
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

kcting
03-29-2010, 05:11 PM
<?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

Fou-Lu
03-29-2010, 07:58 PM
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.



$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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum