ZF2 project stops working when is cloned to local server
<p>I would like to know why when I clone my ZF2 project to a local machine to do some testing it completly stops working.  </p>

<p>In my local machine I have two subfolders, one with a cakePHP project and the other with the ZF2 I've cloned.  </p>

<p>The cakePHP project is working fine since it was there first, but the ZF2, when I try to access to the public folder it prints me:  </p>

<pre><code>{"error":"Something went wrong"}  
</code></pre>

<p>A really generic error... I have no clue about what is going on.  </p>

<p>I've tried some general debug attemps like  </p>

<pre><code>ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
</code></pre>

<p>with no success at all, I've also checked the .htaccess RewriteBase directive to match my subfolder and the DB configuration is done too. </p>

<p>I have researched a bit in the project and the file which displays the error is <code>module/RestfulV2_2/Module.php</code> (Reading the <code>README.md</code> I've discovered is part of <a href="https://github.com/scaraveos/ZF2-Restful-Module-Skeleton" rel="nofollow">ZF2 Restful Module Skeleton</a>):</p>

<pre><code>/**
* @param MvcEvent $e
* @return null|\Zend\Http\PhpEnvironment\Response
*/

public function errorProcess(MvcEvent $e)
    {
        /** @var \Zend\Di\Di $di */
        $di = $e-&gt;getApplication()-&gt;getServiceManager()-&gt;get('di');

        $eventParams = $e-&gt;getParams();

        /** @var array $configuration */
        $configuration = $e-&gt;getApplication()-&gt;getConfig();

        $vars = array();
        if (isset($eventParams['exception'])) {
            /** @var \Exception $exception */
            $exception = $eventParams['exception'];

            if ($configuration['errors']['show_exceptions']['message']) {
                $vars['error-message'] = $exception-&gt;getMessage();
            }
            if ($configuration['errors']['show_exceptions']['trace']) {
                $vars['error-trace'] = $exception-&gt;getTrace();
            }
        }

        if (empty($vars)) {
            $vars['error'] = 'Something went wrong';
        }

        /** @var PostProcessor\AbstractPostProcessor $postProcessor */
        $postProcessor = $di-&gt;get(
            $configuration['errors']['post_processor'],
            array('vars' =&gt; $vars, 'response' =&gt; $e-&gt;getResponse())
        );

        $postProcessor-&gt;process();

        if (
            $eventParams['error'] === \Zend\Mvc\Application::ERROR_CONTROLLER_NOT_FOUND ||
            $eventParams['error'] === \Zend\Mvc\Application::ERROR_ROUTER_NO_MATCH
        ) {
            $e-&gt;getResponse()-&gt;setStatusCode(\Zend\Http\PhpEnvironment\Response::STATUS_CODE_501);
        } else {
            $e-&gt;getResponse()-&gt;setStatusCode(\Zend\Http\PhpEnvironment\Response::STATUS_CODE_500);
        }

        $e-&gt;stopPropagation();

        return $postProcessor-&gt;getResponse();
    } 
</code></pre>

<p>The line which is calling the error in my index.php is:</p>

<pre><code>Zend\Mvc\Application::init(require 'config/application.config.php')-  run();  
</code></pre>

<p>And the only line I found where the error function is called some way is this one in my <code>modele.php</code> : </p>

<pre><code> $sharedEvents-&gt;attach('Zend\Mvc\Application', MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'errorProcess'), 999);
</code></pre>

<p>Can you help me to solve this? I'm inexperienced with ZF2 but I know that with cakePHP to make it work you need to clear the cache folder. Is there any similar process in ZF2? Should I virtualize two servers to avoid conflics?  </p>

<p>Thank you in advance.</p>

<p>EDIT : I've already made virtual hosts to avoid any possible conflict between my two frameworks but the error output is still the same.</p>

<p>EDIT2 : Here is my application.config.php file: </p>

<pre><code>return array(
    // This should be an array of module namespaces used in the application.
    'modules' =&gt; array(
        'Restful',
        'MvlabsSnappy',
        'Qrcode',
        'Application',
        'RestfulV2',
        'RestfulV2_2'
    ),

    // These are various options for the listeners attached to the ModuleManager
    'module_listener_options' =&gt; array(
        // This should be an array of paths in which modules reside.
        // If a string key is provided, the listener will consider that a module
        // namespace, the value of that key the specific path to that module's
        // Module class.
        'module_paths' =&gt; array(
            './module',
            './vendor',
        ),

        // An array of paths from which to glob configuration files after
        // modules are loaded. These effectively override configuration
        // provided by modules themselves. Paths may use GLOB_BRACE notation.
        'config_glob_paths' =&gt; array(
            'config/autoload/{,*.}{global,local}.php',
        ),

        // Whether or not to enable a configuration cache.
        // If enabled, the merged configuration will be cached and used in
        // subsequent requests.
        //'config_cache_enabled' =&gt; $booleanValue,

        // The key used to create the configuration cache file name.
        //'config_cache_key' =&gt; $stringKey,

        // Whether or not to enable a module class map cache.
        // If enabled, creates a module class map cache which will be used
        // by in future requests, to reduce the autoloading process.
        //'module_map_cache_enabled' =&gt; $booleanValue,

        // The key used to create the class map cache file name.
        //'module_map_cache_key' =&gt; $stringKey,

        // The path in which to cache merged configuration.
        //'cache_dir' =&gt; $stringPath,

        // Whether or not to enable modules dependency checking.
        // Enabled by default, prevents usage of modules that depend on other modules
        // that weren't loaded.
        // 'check_dependencies' =&gt; true,
    ),

    // Used to create an own service manager. May contain one or more child arrays.
    //'service_listener_options' =&gt; array(
    //     array(
    //         'service_manager' =&gt; $stringServiceManagerName,
    //         'config_key'      =&gt; $stringConfigKey,
    //         'interface'       =&gt; $stringOptionalInterface,
    //         'method'          =&gt; $stringRequiredMethodName,
    //     ),
    // )

   // Initial configuration with which to seed the ServiceManager.
   // Should be compatible with Zend\ServiceManager\Config.
   // 'service_manager' =&gt; array(),
);
</code></pre>