Jump to content

Recommended Posts

Hi Guys,

 

I am trying to build my application on my local test server (I have tried both WAMP and XAMPP just in case they were the problem) and I just keep getting the following error:

 

Fatal error: Class 'MySQL' not found in C:\xampp\htdocs\webaddress.co.uk\php\core.php on line 44

 

The class file is being included because if I force an error in the file then it picks it up and displays an error!

 

The code for including the class file is:

 

switch ( database_type )
{
case "MySQL":
	require_once ( core_dir."class.my-sql.php" );
	$db = new MySQL( database_host, database_user, database_password, database_name );
	$db->setNames( "utf8" );
	break;
}

 

Really at a loss and any help would be appreciated!  :wtf:

Link to comment
https://forums.phpfreaks.com/topic/206046-php-class-not-found/
Share on other sites

Nope, I have a class called MySQL. But it is not just an issue with this specific class I just commented out the MySQL class and the smarty class that is being include below throws  the same error!  :'(

 

require_once ( smarty_dir."Smarty.class.php" );
$tpl = new Smarty();

Link to comment
https://forums.phpfreaks.com/topic/206046-php-class-not-found/#findComment-1078125
Share on other sites

Is your live server also a Windows server and using the same php version as where your code does not work, because php.net has had a lot of bugs concerning resolving include/require paths and getting the _once versions to see the correct files.

 

Do you have more than one class.my-sql.php file present in other folders?

 

Does this work if you just use require() and not the _once version?

 

What is your core_dir value?

 

 

Link to comment
https://forums.phpfreaks.com/topic/206046-php-class-not-found/#findComment-1078384
Share on other sites

The response to the var_dump was:

 

string(45) "http://localhost/webaddress.co.uk/php/" bool(false)

 

and throwing an exit; before the class is declared I get the same message:

 

Fatal error: Class 'MySQL' not found in C:\xampp\htdocs\webaddress.co.uk\php\core.php  on line 44

 

So looks like the class is just not being declared!! For some damn reason!  :confused:

Link to comment
https://forums.phpfreaks.com/topic/206046-php-class-not-found/#findComment-1078607
Share on other sites

Is your live server also a Windows server and using the same php version as where your code does not work, because php.net has had a lot of bugs concerning resolving include/require paths and getting the _once versions to see the correct files.

 

Do you have more than one class.my-sql.php file present in other folders?

 

Does this work if you just use require() and not the _once version?

 

What is your core_dir value?

 

 

 

Does not work with require or include, have tried that one :)

 

Do not have more than one class and my core path is:

 

http://localhost/webaddress.co.uk/php/

 

Just had a thought the use of a URL could have something to do with it, but I have turned on the setting that allows URLs.

Link to comment
https://forums.phpfreaks.com/topic/206046-php-class-not-found/#findComment-1078608
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.