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

ImgController handler class cannot be loaded

Hi ,

An error which is coming through into the application. In php_error.log I am getting:

Multiple\Frontend\Controllers\ImgController handler class cannot be loaded

I have upgraded to phalcon 3.2 on php 7.1.

As far as I'm aware I am not attemptiong to call ImgController which as the error suggests does not exits.

I can't find where the source of the attempt to call this controller is.

Has anyone else encountered this issue? What am I doing wrong?



47.7k

I think that what is happening is that I have alot of images in my view.

My url on local machine is "/myphalconapp/img/buttons/plus.png" and phalcon is attempting to call a controller but finds the img directory anyway?

I'm not really sure whats going on....

Maybe your image path is invalid, so your webserver forwards the request to index.php, the router extracts the controller name as img, and boom: you get your error.



47.7k
edited Jul '17

That's the thing. All my images have loaded. (edit: I was wrong) @lajosbencz You were bang on correct.

Maybe your image path is invalid, so your webserver forwards the request to index.php, the router extracts the controller name as img, and boom: you get your error.



47.7k

Error dump:

Next Error: Access to undeclared static property: Phalcon\Di::$_default in /Users/myuser/Sites/mysite/apps/config/services.php:6
Stack trace:
#0 [internal function]: Phalcon\Di->__construct()
#1 /Users/myuser/Sites/mysite/apps/config/services.php(6): Phalcon\Di\FactoryDefault->__construct()
#2 /Users/myuser/Sites/mysite/public/index.php(10): require_once('/Users/mysite')
#3 {main}
  thrown in /Users/myuser/Sites/mysite/apps/config/services.php on line 6
[29-Jun-2017 14:38:23 UTC] Multiple\Frontend\Controllers\ImgController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('Multiple\\Fronte...', 2)
#1 [internal function]: Phalcon\Dispatcher->_dispatch()
#2 [internal function]: Phalcon\Dispatcher->dispatch()
#3 /Users/myuser/Sites/mysite/public/index.php(30): Phalcon\Mvc\Application->handle()
#4 {main}
[29-Jun-2017 14:38:23 UTC] PHP Fatal error:  Uncaught Error: Access to undeclared static property: Phalcon\Di::$_default in /Users/myuser/Sites/mysite/apps/config/services.php:6
Stack trace:
#0 [internal function]: Phalcon\Di->__construct()
#1 /Users/myuser/Sites/mysite/apps/config/services.php(6): Phalcon\Di\FactoryDefault->__construct()
#2 /Users/myuser/Sites/mysite/public/index.php(10): require_once('/Users/mysite')
#3 {main}


47.7k

Also getting this intermittently:

Warning: Invalid callback phalcon\version, class 'phalcon\version' not found in Unknown on line 0

Fatal error: Uncaught RuntimeException: Call to undefined method ::getdefault() in [no active file]:0 Stack trace: #0 [internal function]: Phalcon\Tag::getDI() #1 [internal function]: Phalcon\Tag::getUrlService() #2 [internal function]: Phalcon\Tag::linkTo(Array) #3 [internal function]: Phalcon\Debug->getVersion() #4 [internal function]: Phalcon\Debug->onUncaughtException(Object(RuntimeException)) #5 {main} thrown in [no active file] on line 0


47.7k

I only appear to get the errors when i refresh the page.



3.4k
edited Jun '17

Hello,

Your global path look like '/Users/myuser/Sites/mysite/...'

#2 /Users/myuser/Sites/mysite/public/index.php(10): require_once('/Users/mysite')

require_once look like not correspond with your global path.



47.7k

sorry my fault there is a hidden ellipsis there so require_once('/Users/mysite...')

Hello,

Your global path look like '/Users/myuser/Sites/mysite/...'

#2 /Users/myuser/Sites/mysite/public/index.php(10): require_once('/Users/mysite')

require_once look like not correspond with your global path.



47.7k

Its possible this is because my php version has not been compiled with "--enable-fpm" I will test this and update...



47.7k

Recompiled with "--enable-fpm" php 7.1.5 succesfully.

Unfortunately this problem is still occurring on page refresh.



3.4k

Sorry, I've no more idea except trying a debuger on IDE like phpstorm

https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html

good luck ;o))



47.7k

haha. thanks!



47.7k

Hi,

I installed the debugger and tried again. Strangley enough initially using the debugger seemed to fix the issue. Then the site stopped working as php was attempting to allocate 4.5G of memory well out of range of my 1G limit.

I will look at moving my dev environment over to docker as attemping to develop phalcon in osx is proving troublesome.