spl_autoload server related issue

175 views Asked by At

We seem to have a very strange problem with the spl_autoload on 1 particular servers. Warning: spl_autoload() [function.spl-autoload]: Unable to access file.php

public function loadClass($className) {

        if(substr($className, -5) == 'Override') {

            $classes = glob(_ROOT_DIR_ . 'classes/*/override/*/*.php');

            foreach($classes AS $class) {
                $explodePath = explode('/', $class);
                $explodePath = array_reverse($explodePath);

                if(file_exists(_ROOT_DIR_.'classes/'.$explodePath[3].'/override/'.$explodePath[1].'/'.$explodePath[0])) {
                    set_include_path(get_include_path().PATH_SEPARATOR._ROOT_DIR_.'classes/'.$explodePath[3].'/override/'.$explodePath[1].'/');
                    spl_autoload(strtolower($className));
                }
            }
        }
        return FALSE;
    }

Also I have checked and in our WHM panel it shows the include path is set to .:/usr/lib/php:/usr/local/lib/php

This particular server is Linux RedHat-9.3.6 running PHP 5.3.8 & eAccelerator the code above has been testing on 10 other servers and works fine so really at lost to why this would be happening on this particular server.

We would really like to use the spl_autoload method instead of include/require which would slow down our application. Please I hope someone can offer some advice with helping us to solve this issue.

0

There are 0 answers