tags:

views:

86

answers:

5

I have some pages, which work fine locally(using WAMP and error_reporting E_ALL in php.ini), but once I upload them, I get the following error: Fatal error: Call to undefined method DB::exists() The method is there, and I don't know why it can't be seen.

Do you have an idea what went wrong?

+1  A: 

No, the method isn't there. Sooner you learn to trust to the error messages, sooner you get your app to work.

Col. Shrapnel
While this is true, it is not helpful to anyone.
Dolph
definitely not an answer. probably more suited to be a comment.
thephpdeveloper
actually it's more than answer. To trust your eyes is the first thing to learn in programming
Col. Shrapnel
A: 

you have probably installed pear and some libraries in other place than your website code. check where points you includes in php.ini and upload that too

fazo
A: 

You probably want to check the webserver's php.ini configuration against your local php.ini to see if there is any modules not loaded on the webserver which may be required in your PHP application.

Also, check the version numbers of PHP on your webserver and local php as well as checking up the web for limitations of your PHP version.

thephpdeveloper
A: 

Try putting a debug statement into the file that defines class DB and DB::exists(), such as:

echo "DB file was included\n";

Does that message appear? If not, then the file isn't being included, which explains why the method isn't found.

Find the the location where that file is supposed to be getting included, and examine the include path at the point:

echo "Include path is: " . get_include_path() . "\n";

Does another file with the same name exist in one of the other directories listed in the include path? If so, you might need to alter the other of the entries in your include path (which is defined by include_path in php.ini, but can also be edited at runtime with set_include_path())

Sam Minnée
A: 

The server has Pear::DB installed (http://pear.php.net/package/DB/redirected). Your autoload function is loading Pear's DB class instead of yours.

If you have control over the server, something like this should work

$ sudo pear uninstall DB

If you don't have control over the server, you'll need to rename your DB class to something else...

You could modify the include_path to load PEAR classes after your own classes, but that could lead to other naming conflicts.

mehaase