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

PhalconException: Service 'view' cannot be resolved

Just installed Phalcon on Ubuntu and tried the Tutorial App and whenever I try loading it I get:

PhalconException: Service 'view' cannot be resolved

Now I am sure Phalcon is installed and loaded since it was app to pass few lines and getting the autoloader and so on.

Here is what I get from <?php print_r(get_loaded_extensions()); ?>:

Array ( ............... [41] => apache2handler [42] => phalcon [43] => PDO ............ )

My PHP Version is 5.4.9



98.9k

Is this code part of your bootstrap (public/index.php)?

//Setting up the view component
$di->set('view', function(){
    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir('../app/views/');
    return $view;
});


1.5k

Yes ... actually whenever something is set there it gives similar error

if I try to set 'routes' or any other service ....

Have I done something wrong here :S ?



98.9k

Maybe the installer detected a wrong architecture...

Can you try compiling phalcon with:

cd cphalcon/build
sudo ./install 32bits

If it didn't work too, try with 64bits

cd cphalcon/build
sudo ./install 64bits


1.5k

With 32bits Installation it says:

PhalconException : A dependency injection object is required to access internal services

and with 64bits is says:

PhalconException: Service 'view' cannot be resolved

Note: My Machine is 64bits thing ! Any clues



98.9k

Can you post the code of your application?



1.5k

I am simply trying to run this:

https://github.com/phalcon/tutorial



1.5k

Yes sure ... I downloaded the whole tutorial (git clone) and it has everything in there.

Just double checked now and it is there + with 64bits installation it does seem to have it but can't resolve a service set to that



1.5k

No hope here :S ?!



1.5k
Accepted
answer

Perfect ... thanks to "Andres Gutierrez" @Phalcon this issue was resolved.

The problem is that for some other project I had eAccelerator installed on my machine and for some reason the current version phalcon php framework is not compatible with eAccelerator.

Although I have no good reason to have this extension installed there would be a fix for this in some coming versions :D Until then if you have the same problem simply disable (comment out) this extension and the thing would work :)