ZF2 project stops working when cloned to local server

I would like to know why when I clone my ZF2 project to a local computer in order to conduct some testing, it completely stops working.

In my local machine, I have two subfolders, one with the cakePHP project, and the other with ZF2, which I cloned.

The cakePHP project works fine since it was the first, but ZF2, when I try to access the shared folder, it prints me:

{"error":"Something went wrong"}  

Really a common mistake ... I have no idea what is going on.

I tried some general debugs, like

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

does not succeed, I also checked the .htaccess RewriteBase directive to match my subfolder, and the database setup was also done.

, , , - module/RestfulV2_2/Module.php ( README.md, , ZF2 Restful Module Skeleton):

/**
* @param MvcEvent $e
* @return null|\Zend\Http\PhpEnvironment\Response
*/

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

        $eventParams = $e->getParams();

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

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

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

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

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

        $postProcessor->process();

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

        $e->stopPropagation();

        return $postProcessor->getResponse();
    } 

, index.php, :

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

, , - , - modele.php:

 $sharedEvents->attach('Zend\Mvc\Application', MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'errorProcess'), 999);

? ZF2, , cakePHP, , . ZF2? , ?

.

EDIT: , , .

EDIT2: application.config.php:

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

    // These are various options for the listeners attached to the ModuleManager
    'module_listener_options' => 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' => 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' => 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' => $booleanValue,

        // The key used to create the configuration cache file name.
        //'config_cache_key' => $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' => $booleanValue,

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

        // The path in which to cache merged configuration.
        //'cache_dir' => $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' => true,
    ),

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

   // Initial configuration with which to seed the ServiceManager.
   // Should be compatible with Zend\ServiceManager\Config.
   // 'service_manager' => array(),
);
+4
2

index.php , (DirectoryIndex), - , , :

<?php
  phpinfo();

, - , php. , , , .. , script.

, phpinfo() , . , - , .

no - , , DB... , connect, bind,....

, , , . , - echo __LINE__ . ' works!<br/>'; , index.php :

<?php

// original code block 1

  echo __LINE__ . ' works!<br/>';

// original code block 2

  echo __LINE__ . ' works!<br/>';

, .

, , .

+2

. , , , .

local.config.php.

return [
    'errors'=> [
        'show_exceptions' => [
            'message' => true,
            'trace'   => true
        ],
    ],
];

, $eventParams - , .

+1

All Articles