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):
public function errorProcess(MvcEvent $e)
{
$di = $e->getApplication()->getServiceManager()->get('di');
$eventParams = $e->getParams();
$configuration = $e->getApplication()->getConfig();
$vars = array();
if (isset($eventParams['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';
}
$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(
'modules' => array(
'Restful',
'MvlabsSnappy',
'Qrcode',
'Application',
'RestfulV2',
'RestfulV2_2'
),
'module_listener_options' => array(
'module_paths' => array(
'./module',
'./vendor',
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
),
);