Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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 printr(getloaded_extensions()); ?>:

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

My PHP Version is 5.4.9



82.7k

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;
});


961

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 ?



82.7k

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


961

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



82.7k

Can you post the code of your application?



961

I am simply trying to run this:

https://github.com/phalcon/tutorial



961

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



961

No hope here :S ?!



961
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 :)