Hi,
I have a problem with Cli which is working on localhost(apache2):
<?php
use Phalcon\DI\FactoryDefault\Cli as CliDI,
Phalcon\Cli\Console as ConsoleApp,
Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
$di = new CliDI();
define('__URL__', 'milan.local');
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__)));
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
APPLICATION_PATH . '/tasks'
))->register();
$loader->registerNamespaces(array(
'Models\Settings' => APPLICATION_PATH . '/models/settings/',
'Models\User' => APPLICATION_PATH . '/models/user/',
'Library' => APPLICATION_PATH . '/library/'
))->register();
if (is_readable(APPLICATION_PATH . '/config/config.php')) {
$config = include APPLICATION_PATH . '/config/config.php';
$di->set('config', $config);
}
$console = new ConsoleApp();
$console->setDI($di);
$arguments = array();
foreach ($argv as $k => $arg) {
if ($k == 1) {
$arguments['task'] = $arg;
} elseif ($k == 2) {
$arguments['action'] = $arg;
} elseif ($k >= 3) {
$arguments['params'][] = $arg;
}
}
$di->set('db', function () use ($config) {
return new DbAdapter(array(
'host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname,
'charset' => $config->database->charset,
));
});
define('CURRENT_TASK', (isset($argv[1]) ? $argv[1] : null));
define('CURRENT_ACTION', (isset($argv[2]) ? $argv[2] : null));
try {
$console->handle($arguments);
} catch (\Phalcon\Exception $e) {
echo $e->getMessage();
exit(255);
}
but at the server i have an error:
PHP Fatal error: Class 'Phalcon\DI\FactoryDefault\Cli' not found in /var/www/clients/client1/web2/web/app/cli.php on line 7
What am I doing wrong?
Please, help me.
Regards, nansss