Page 1 of 1

Mysqli.class.php inclusion

Posted: Wed Nov 25, 2009 3:18 pm
by BlasterV
I am trying to set up a website in php using Apache 2.2 on Windows. I'll note that I did not create the website I am trying to set up. I am running into this issue:

"Warning: include_once(mysqli.class.php) [function.include-once]: failed to open stream: No such file or directory in PATH" which of course leads to: "Fatal error: Class 'MySQLHandler' not found".

I've set up other php websites and have run into this problem before. Normally, I would adjust the include_path in php.ini to wherever the dependency is and the problem would be solved. However, this file "mysqli.class.php" does not seem to exist as a file in the same way other php files do, so I have no idea how to include it. That's where I'm stuck right now. I am not getting any other warnings or errors with the website.

Thanks for any help!

Re: Mysqli.class.php inclusion

Posted: Mon Nov 30, 2009 8:21 am
by BlasterV
Bump. Still need help! :(

Re: Mysqli.class.php inclusion

Posted: Mon Nov 30, 2009 9:18 am
by jackpf
Are you using an absolute reference to the file?

Re: Mysqli.class.php inclusion

Posted: Mon Nov 30, 2009 10:49 am
by BlasterV
jackpf wrote:Are you using an absolute reference to the file?
Inside the php files themselves there is an "include" and "mysqli.class.php" is hardcoded with no path. In the php.ini file I am attempting to figure out where that file is so I can add it to the include_path, then the php files would be able to find the class file. I am using absolute includes on the include_path e.g. "c:\php\ext"

Re: Mysqli.class.php inclusion

Posted: Mon Nov 30, 2009 1:04 pm
by jackpf
Hmm...

You're absolutely sure the file exists?

For example, say your directory structure is

root/
-----/includes/
-----/---------/classes/

If your script was in the document root, and you wanted to include "somefile.php" in includes/classes, this should work:

Code: Select all

include $_SERVER['DOCUMENT_ROOT'].'/includes/classes/somefile.php';
If you then go to http://yoursite.com/includes/classes/somefile.php, it should exist.

I suggest you do this sort of checking with your file...

Can't really think what else it would be.

Re: Mysqli.class.php inclusion

Posted: Thu Dec 03, 2009 3:19 pm
by BlasterV
Hello again, I've had more time to look into the error and I've made progress (I am 100% certain the website can access the database properly and pull data)

Here is more error information:

Warning: include_once(mysqli.class.php) [function.include-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\db.php on line 3

Warning: include_once() [function.include]: Failed opening 'mysqli.class.php' for inclusion (include_path='c:\php;c:\php\includes;c:\php\ext;c:\php\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes;C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\admin\_kfm\includes\pear;c:\php\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\config_mdb2.php;C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\admin\_kfm\includes\pear\mdb2\driver;') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\db.php on line 3

Fatal error: Class 'MySQLHandler' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\db.php on line 7

Here is the db.php file:

<?
session_start();

include_once "mysqli.class.php";

include_once($_SERVER['DOCUMENT_ROOT'].'/includes/site_constants.php');

$DB = new MySQLHandler($DB_DSN['database'],$DB_DSN['username'],$DB_DSN['password'],"localhost", true);


// A string to salt the database for encryption.
// There is a salt and such but I am leaving it out.

function enc_url($url){
return str_replace("/","|",str_replace(" ","+",$url));
}
function denc_url($url){
return str_replace("|","/",$url);
}
function generateNewSalt(){
return substr(md5(uniqid(rand(), true)), 0, 9);
}
function enable_aes() {
global $DB;
$DB->query( "SELECT @password:='".DB_SALT."'" );
}
function disp_date($dateStr, $format){
list($y,$m,$d)=split("[-]",substr($dateStr,0,10));
list($h,$i,$s)=split("[:]",substr($dateStr,11));
return date($format,mktime($h,$i,$s,$m,$d,$y));
}
?>

The line in bold is where the error occurs.

Any more help is appreciated.

Re: Mysqli.class.php inclusion

Posted: Fri Dec 04, 2009 9:05 am
by BlasterV
bump

Re: Mysqli.class.php inclusion

Posted: Fri Dec 04, 2009 10:06 am
by LucosidE
I had a problem using mysqli
had to uncomment the line

extension=php_mysqli.dll

in php.ini
so it loads automatically.