Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function DB() in ... /system/core/Loader.php on line 346
#1

[eluser]thomasz[/eluser]
I am truly at my wits end and need some assistance. I am not a newbie as I have been working with CI since 2008 and live in a hosted production environment late in that year. I am running LAMP with Ubuntu 10.04 and php 5.3.2 and in the processes of bringing up a new production server. I have a staging environment running with same version of Ubuntu and PHP and everything works fine. However when I deploy out to my [new] hosted server everything falls apart.

When I go to the home page I am getting the following error:
Call to undefined function DB() in [path]/system/core/Loader.php on line 346

This is getting triggered when the database() function is called in Loader.php. I have verified the permissions as well as the ability for the file to get loaded (I tried reading it with file_get_contents using the same string.

Other PHP apps are working fine including phpMyAdmin so I feel the LAMP configuration is fine. I have also tried deleting and reuploading the full site multiple times. I am completely out of ideas and don't know what to try next!
#2

[eluser]BrokenLegGuy[/eluser]
Not trying to be a jerk here because I feel your pain, but have you tried just a virgin copy of CI? That error could be a bunch of different things.
#3

[eluser]thomasz[/eluser]
RESOLVED!

Thanks for the help. At your suggestion I tried a clean install and it didn't resolve the issue. The clean site worked but as I layered back in my site (configs, helpers, libraries, controllers, etc) it quickly broke again.

This led to more experimentation that eventually led to the revelation ... APC! I disabled APC and the site started working. Re-enabled and it broke again. Now I was on to something.

Next I looked at the apc.ini file I was using. This is an exact match of my production site.
extension=apc.so
apc.enabled=1
apc.include_once_override = 2
apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.ttl=7200
apc.user_ttl=7200
apc.shm_size=20M

However my test server was only using the first line. So I commented out the other lines and it worked! Now here's the weird part. I then re-enabled each line (with a corresponding apache restart) and it still worked. I am nowt running again in the original configuration (with all the above lines enabled and everything works! I've even manually cleared the opcode cache and it's still all working.

I am happy it's working but disappointed that it appears to be an anomaly.




Theme © iAndrew 2016 - Forum software by © MyBB