I have build a phalcon MVC project, it runs fine on my local machine which is Ubuntu 18.04, while deploying on the server, CentOS 7, it throws this error. It's Phalcon v4.
#0 /var/www/html/gadgetsplash/ui/public/index.php(46): Phalcon\Di->__call() #1 {main}
Below is index.php
<?php
use Phalcon\Di\FactoryDefault;
ini_set("date.timezone", "Africa/Nairobi");
ini_set('default_socket_timeout', 160);
ini_set('max_execution_time', 120);
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
try {
$di = new FactoryDefault();
$config = $di->getConfig();
} catch (Exception $exception){
error_log("error config: ".$exception->getTraceAsString());
echo $exception->getTraceAsString();
return;
}
try {
include APP_PATH . '/config/router.php';
include APP_PATH . '/config/services.php';
include APP_PATH . '/config/loader.php';
include "../vendor/autoload.php";
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
} catch (\Exception $e) {
echo $e->getMessage() . '<br>';
echo '<pre>' . $e->getTraceAsString() . '</pre>';
}
The error is thrown on try...catch here: $config = $di->getConfig();
This is the last part of my config file:
$configs['application'] = [
'controllersDir' => APP_PATH . '/controllers/',
'modelsDir' => APP_PATH . '/models/',
'viewsDir' => APP_PATH . '/views',
'cacheDir' => APP_PATH . '/cache/',
'baseUri' => $baseUrl,
'appDir' => APP_PATH . '/',
'vendorDir' => APP_PATH . '/vendor/',
'utilsDir' => APP_PATH . '/Utils/',
];
return new \Phalcon\Config($configs);