# How to fix "Fatal error: Interface

**URL:** <https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141>\
**Category:** Components & MVC\
**Tags:** zend-mvc\
**Created:** [August 5, 2019, 7:13pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141 "2019-08-05T19:13:15Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 5, 2019, 7:13pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/1 "2019-08-05T19:13:15Z")

</div>

How to fix "Fatal error: Interface ‘Zend\ModuleManager\Feature\AutoloaderProviderInterface’ not found  
I am creating a module on `ZF2` .

I tried different ways creating `Module.php` , but am not getting output. Not sure where i am getting wrong.

```auto
<?php

namespace Admin;

use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;

class Module implements AutoloaderProviderInterface, ConfigProviderInterface
{  
    public function getAutoloaderConfig()
    {  
        return array(
                    'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__. '/src/' . __NAMESPACE__ ,
                ),
            ),
        );
    }
public function getConfig()
    {
        return include __DIR__. '/../config/module.config.php';
    }
}

```

This is the error message i am getting :

_Fatal error: Interface ‘Zend\ModuleManager\Feature\AutoloaderProviderInterface’ not found in C:\xampp\htdocs\project\module\Admin\src\Module.php on line 8_

---

<div class="post-metadata">

**Author:** ![ocramius](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/ocramius/32/23_2.png) [@ocramius](https://discourse.laminas.dev/u/ocramius)\
**Post date:** [August 5, 2019, 7:25pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/2 "2019-08-05T19:25:16Z")

</div>

Is `zendframework/zend-modulemanager` in your `composer.lock` and in `vendor/zendframework`?

Did you include ` __DIR__. '/vendor/autoload.php` somewhere at the startup of your application?

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 5, 2019, 9:28pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/3 "2019-08-05T21:28:00Z")

</div>

Is `zendframework/zend-modulemanager` in your `composer.lock` and in `vendor/zendframework` ?

- Yes, it is.

Did you include ` __DIR__. '/vendor/autoload.php` somewhere at the startup of your application?

- Yes, i did create the file as admin.php and previously tried with include ` __DIR__. '/vendor/autoload.php` - but was getting errors as below :

**Warning** : include(C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php): failed to open stream: No such file or directory in **C:\xampp\htdocs\project\module\Admin\admin.php** on line **18**

**Warning** : include(): Failed opening ‘C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php’ for inclusion (include\_path=‘C:\xampp\php\PEAR’) in **C:\xampp\htdocs\project\module\Admin\admin.php** on line **18**

Not sure, how to go through…

---

<div class="post-metadata">

**Author:** ![guidofaecke](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/guidofaecke/32/427_2.png) [@guidofaecke](https://discourse.laminas.dev/u/guidofaecke)\
**Post date:** [August 6, 2019, 2:02am UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/4 "2019-08-06T02:02:40Z")

</div>

> [@Raj](#):
>
> Did you include ` __DIR__. '/vendor/autoload.php` somewhere at the startup of your application?
> 
> - Yes, i did create the file as admin.php and previously tried with include ` __DIR__. '/vendor/autoload.php` - but was getting errors as below :
> 
> **Warning** : include(C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php): failed to open stream: No such file or directory in **C:\xampp\htdocs\project\module\Admin\admin.php** on line **18**

Silly idea, try to add another ‘…/’ to the beginning of your include path or move the include to your index.php within the public folder.

---

<div class="post-metadata">

**Author:** ![lowtower](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/lowtower/32/98_2.png) [@lowtower](https://discourse.laminas.dev/u/lowtower)\
**Post date:** [August 6, 2019, 5:27am UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/5 "2019-08-06T05:27:58Z")

</div>

> **Warning** : include(C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php)

I can see **three** dots in the path between _Admin_ and _vendor_ which may cause the trouble!

---

<div class="post-metadata">

**Author:** ![guidofaecke](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/guidofaecke/32/427_2.png) [@guidofaecke](https://discourse.laminas.dev/u/guidofaecke)\
**Post date:** [August 6, 2019, 7:21am UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/6 "2019-08-06T07:21:41Z")

</div>

FYI: I typed 2 and get 3 in return 🙂

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 6, 2019, 7:16pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/7 "2019-08-06T19:16:50Z")

</div>

I have tried, but didn’t work. Also when i added:

“autoload”: {  
“psr-4”: {  
“Admin\”: “module/Admin/src/”  
}  
},  
in composer.json

I get below message when i run composer update on command line

Key autoload is a duplicate in ./composer.json

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 6, 2019, 7:27pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/8 "2019-08-06T19:27:41Z")

</div>

You can compare your `composer.json` with the quick start tutorial or the skeletion application:

[https://docs.zendframework.com/tutorials/getting-started/modules/#autoloading](https://docs.zendframework.com/tutorials/getting-started/modules/#autoloading)

> <https://github.com/zendframework/ZendSkeletonApplication/blob/cda8fa6d07690cd07cb0e41f9831f1ae4acfee6c/composer.json#L21-L25>

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 6, 2019, 8:40pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/9 "2019-08-06T20:40:35Z")

</div>

Followed, and now no message appears in command, but i start getting new errors as below:

Error

File:

```
C:\xampp\htdocs\project\vendor\zendframework\zend-servicemanager\src\Factory\InvokableFactory.php:30

```

Message:

```
Class 'Admin\Controller\IndexController' not found

```

Stack trace:

```
#0 C:\xampp\htdocs\project\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(764): Zend\ServiceManager\Factory\InvokableFactory->__invoke(Object(Zend\ServiceManager\ServiceManager), 'Admin\\Controlle...', NULL)
#1 C:\xampp\htdocs\project\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(200): Zend\ServiceManager\ServiceManager->doCreate('Admin\\Controlle...')
#2 C:\xampp\htdocs\project\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php(152): Zend\ServiceManager\ServiceManager->get('Admin\\Controlle...')
#3 C:\xampp\htdocs\project\vendor\zendframework\zend-mvc\src\DispatchListener.php(102): Zend\ServiceManager\AbstractPluginManager->get('Admin\\Controlle...')
#4 C:\xampp\htdocs\project\vendor\zendframework\zend-eventmanager\src\EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#5 C:\xampp\htdocs\project\vendor\zendframework\zend-eventmanager\src\EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#6 C:\xampp\htdocs\project\vendor\zendframework\zend-mvc\src\Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#7 C:\xampp\htdocs\project\public\index.php(40): Zend\Mvc\Application->run()
#8 {main}
```

---

<div class="post-metadata">

**Author:** ![guidofaecke](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/guidofaecke/32/427_2.png) [@guidofaecke](https://discourse.laminas.dev/u/guidofaecke)\
**Post date:** [August 7, 2019, 2:04am UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/10 "2019-08-07T02:04:49Z")

</div>

That could be as simple as:

- namespace typed wrong in your controller
- `IndexController.php` missing under `/module/Admin/src/Controller`

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 7, 2019, 7:15am UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/11 "2019-08-07T07:15:07Z")

</div>

Thank you very much, works well now.

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 7, 2019, 2:33pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/12 "2019-08-07T14:33:17Z")

</div>

I created 2 more modules and did like below:

```
"autoload": {
        "psr-4": {
            "Application\\": "module/Application/src/",
            "Admin\\": "module/Admin/src/",
            "User\\": "module/User/src/",
            "Vendor\\": "module/Vendor/src/"
        }
    },

```

But only last vendor module is working, and other two user and admin module are not working. So is that i will require to create different autoload snippet for admin and user module and add in composer.json ?

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 7, 2019, 6:03pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/13 "2019-08-07T18:03:12Z")

</div>

> [@Raj](#):
>
> other two user and admin module are not working

Have you create the module classes?  
Compare with: [Modules - Tutorials - Zend Framework Docs](https://docs.zendframework.com/tutorials/getting-started/modules/#setting-up-the-album-module)

Have you register your modules?  
Compare with: [Modules - Tutorials - Zend Framework Docs](https://docs.zendframework.com/tutorials/getting-started/modules/#informing-the-application-about-our-new-module)

And do not forget the related Composer command:

```bash
$ composer dump-autoload

```

Compare with: [Modules - Tutorials - Zend Framework Docs](https://docs.zendframework.com/tutorials/getting-started/modules/#autoloading)

---

<div class="post-metadata">

**Author:** ![Raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Raj](https://discourse.laminas.dev/u/Raj)\
**Post date:** [August 7, 2019, 6:51pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/14 "2019-08-07T18:51:11Z")

</div>

Yes, have created module classes and registered modules, already followed whatever was suggested by you and repeated same again, but still same results. Is that i am missing something?

---

<div class="post-metadata">

**Author:** ![guidofaecke](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/guidofaecke/32/427_2.png) [@guidofaecke](https://discourse.laminas.dev/u/guidofaecke)\
**Post date:** [August 8, 2019, 1:44pm UTC](https://discourse.laminas.dev/t/how-to-fix-fatal-error-interface/1141/15 "2019-08-08T13:44:50Z")

</div>

Another option could be that you have `module_map_cache_enabled` in `application.config.php` set to true.  
In that case it can’t hurt to go to the `data/cache/` directory and just delete all files starting with `"module-"`.
