I know this has to do with the path not being quite right but it has me baffled. I can run my script with no problems at all from the browser but when I do to the exact same spot from a shell, spl_autoload complains and dies:
Fatal error: spl_autoload(): Class db could not be loaded in...
I am using the absolute path from the root directory, echoed to screen and pasted it into a shell and verified that it is good. Please... what am I missing??
Try using the __DIR__ constant to locate the files, CLI PHP doesn't uses the same working dir.
Use something like this:
function __autoload($class)
{
require_once(dirname(__FILE__) . '/path/to/libraries/' . $class . '.php');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With