We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Fatal error: Class 'Phalcon\DI\FactoryDefault' not found in

Hi,

I followed the installation instructions here:

https://docs.phalcon.io/en/latest/reference/install.html

I'm on CentOS 6.6, PHP 5.3, latest PhalconPHP build

When I navigate to my website from the browser I'm getting this error message:

Fatal error: Class 'Phalcon\DI\FactoryDefault' not found in /home/web/sites/curbquote-phalcon/public/index.php on line 25

Tried different version of PHP (5.4) but still no joy

I also tried to downgrade PhalconPHP to 1.2.6 which I believe was used when we originally deployed our application, but still nothing.

Here's the code in index.php

<?php
/** set default time zone **/
date_default_timezone_set('America/Boise');

/** Define App Constants **/
if ( !defined('ROOT_PATH') )
    define('ROOT_PATH', dirname(dirname(__FILE__)));

if ( !defined('APP_PATH') )
    define('APP_PATH', ROOT_PATH . '/app/' );

if( !defined('URL') )
    define('URL', 'https://' . $_SERVER['SERVER_NAME']);

try {
    include ROOT_PATH . "/app/bootstrap.php";

    /** Dependencies **/
    $di = new Phalcon\DI\FactoryDefault();
    $app = new Bootstrap($di);
    echo $app->run(array());

} catch (\Phalcon\Exception $e) {
        echo $e->getMessage();
} catch (PDOException $e){
        echo $e->getMessage();
}

Any ideas on how can I debug this issue further?

Thanks



3.4k

Very likely phalcon is not loaded. put a phpinfo() in your index.php to see if phalcon is loaded. If not it is likely that you have not the same version of your php5 as your php5-dev when you compiled phalcon. Check apache log error when you restart your server.



5.6k

I checked the phpinfo() as you said and it looks like Phalcon is indeed not being loaded. What's the course of action now? I tried to remove php and php-dev, then install it again, and then install phalcon as well, but I'm still stuck at the same error message, and moreover, after all those steps phalconphp is still not showing up in phpinfo().

It looks like you don't loaded it in phalcon.ini. Try to do locate phalcon.so



5.6k
edited Feb '15

After running locate phalcon.so this is the output:

  • /home/cphalcon/build/64bits/.libs/phalcon.so
  • /home/cphalcon/build/64bits/modules/phalcon.so
  • /home/cphalcon/ext/.libs/phalcon.so
  • /home/cphalcon/ext/modules/phalcon.so
  • /usr/lib64/php/modules/phalcon.so

You need to:

  1. Find which config file you use with your php (it can be done in phpinfo() function output)
  2. Insert into this file at the bottom: extension=phalcon.so
  3. Reload Apache/PHP-fpm or something like that

Thanks! Me ayudo demasiado, muchisimas gracias!