CodeIgniter Forums

Full Version: Problems conntecting to db, an error with BASEPATH maybe?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I hope i'm posting this in the right place, could someone have a look at the following error and possibly help?:

Fatal error: require_once() [function.require]: Failed opening required '/home/darkdreams/www/www/system/database/drivers/mysql/mysql_driver.php' (include_path='.:/usr/local/php5/lib/php') in /home/darkdreams/www/www/system/database/DB.php on line 129

Now it seems to me that the url there has got the www folder in there one too many times. I have access to the level above www with my webspace but at the moment everything is located in the www folder (I couldnt work out how to put things outside it)

Now when I look at line 129 in DB.php i see that the url is made up using BASEPATH which I gather gets the base path from the server. Is there any way to define this as it would seem to be the problem.

If it helps my mySQL set up is as follows:

Local (web applications): Host: localhost | Socket: /tmp/mysql5.sock
Note: Most PHP applications/scripts will accept the following syntax:
MySQL Host: localhost:/tmp/mysql5.sock

and my database config file looks like this:

$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost:/tmp/mysql5.sock";
$db['default']['username'] = "**********";
$db['default']['password'] = "**********";
$db['default']['database'] = "**********";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

Any help or pointers as to how i can figure this out myself would be greatly appreciated


El Forum

What if you just set the hostname to "localhost"?

El Forum

Oooh a reply, I thought this one fell to the wayside Smile

Same error I'm afraid. I'll change it and upload the file though, might help.

Is it me or does the www/www/ look wrong in the url at all?

El Forum

I only use localhost when I'm connecting... unless the MySQL server is in a remote location.

El Forum

Same here but this is new hosting and to be honest i've not got it working with or without the socket stuff on the end.

The url is and is currently set to localhost as suggested. I found this on the hosting help site:

To access your MySQL database from your PHP scripts, you need to provide the following database server name in your connection string:


Here is a sample connection string to use with MySQL 5:

$link = mysql_connect('localhost:/tmp/mysql5.sock', 'mysql_user', 'mysql_password');

Any clues?

El Forum

Sorry, Ive never seen that before. You should probably just call the support for your hosting company, thats an abnormal setup.

El Forum

Will do, thanks for the help Smile

El Forum

:down: where's the facepalm smiley? so after looking all over and still not figuring this out it turns out that filezilla only uploaded 50% of the overall site files! It wasn't even a group of folders, it was random files.

Turns out though that the weird socket stuff is required for my space.

Sorry for the waste of time, move along nothing to see here :lol:

Oh and thanks again Smile

El Forum

you have www/www should only be www/system

Probality your base_url path


El Forum

Actually it turns out the www/www is correct. My server grants me access to the folder outside the www folder which, bizarrely is called www.

The problem was down to user error, the ftp didn't complete properly and random files were missed. It took comparing each file name folder by folder to fix it.

Thanks for the reply though.