Phalcon Framework 2.0.13

Phalcon\Exception: Cannot connect to Memcached server

/var/www/web_ggm_new/app/library/Helper/Application.php (81)
#0Helper\Application->registerModules()
/var/www/web_ggm_new/app/bootstrap.php (187)
<?php
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Router;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter;
/**
 * Description of bootstrap
 *
 * @author Webvizitky, Softdream <info@webvizitky.cz>,<info@softdream.net>
 * @copyright (c) 2014 - 2015, Miranthis a.s.
 */
 
try {
 
    $configAddition = (!empty(ENVIRONMENT) ? '.' . ENVIRONMENT  : '');
    $config = new \Phalcon\Config\Adapter\Json("../app/config/config" . $configAddition . ".json");
 
$loader = new \Phalcon\Loader();
/**
 * We're a registering a set of directories taken from the configuration file
 */
$loader->registerDirs(
    array(
        $config->application->libraryDir,
        $config->application->pluginsDir
    )
)->registerNamespaces(['Core' => __DIR__.'/library/Core/'])->register();
 
 
 
 
/**
 * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
 */
$di = new FactoryDefault();
 
$di->set('config', $config);
$di->set('assets',new \Assets(),true);
 
$di->set('request',function(){
    return new Core\Http\Request();
});
 
$di->set('formsManager',function(){
    return new Core\Form\Manager();
},true);
 
$di->set('response',function(){
    return new Core\Http\Response();
});
/**
  The URL component is used to generate all kind of urls in the application
 */
$di->set('url', function () use ($config) {
    $url = new UrlResolver();
    $url->setBaseUri($config->application->baseUri);
 
    return $url;
}, true);
 
$di->set('cache',\Core\Cache::factory('data', 'memcache', $config->memcache->toArray()), true);
 
$di->set('templateEngine', function($view, $di) use($config) {
    $engine = new VoltEngine($view, $di);
    $engine->setOptions(
        array(
            'compiledPath' => $config->application->templateEngineCachePath
        )
    );
 
    $compiler = $engine->getCompiler();
 
    $compiler->addFunction('range', function($resolvedArgs, $exprArgs) {
        $ret = '';
 
        $start = 0;
        $end = intval($exprArgs[0]['expr']['value']);
 
        if(count($exprArgs) > 1) {
            $start = $end;
            $end = intval($exprArgs[1]['expr']['value']);
        }
 
        for($i = $start; $i < $end; $i++) {
            if($i > $start) {
                $ret .= ',';
            }
            $ret .= $i;
        }
 
        return '[' . $ret . ']';
    });
 
    //register getImage snippet to template
    $compiler->addFunction('getImage',function($resolvedArgs,$exprArgs) use($compiler){
        $path = isset($exprArgs[0]['expr']) ? $compiler->expression($exprArgs[0]['expr']) : null;
        $base64 = isset($exprArgs[1]['expr']) ? $compiler->expression($exprArgs[1]['expr']) : false;
        $w = isset($exprArgs[2]['expr']) ? $compiler->expression($exprArgs[2]['expr']) : null;
        $h = isset($exprArgs[3]['expr']) ? $compiler->expression($exprArgs[3]['expr']) : null;
        $default = '/images/no-image.png';
 
        return "$path";
        if(!$path || $path == ''){
            return "\"$default\"";
        }
 
        return "\Core\File\Adapter\Image::getImage(".$path.",".$base64.",".$w.",".$h.")";
    });
 
    return $engine;
}, true);
 
 
/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di->set('db', function () use ($config) {
    $config = array(
        'host' => $config->database->host,
        'username' => $config->database->username,
        'password' => $config->database->password,
        'dbname' => $config->database->dbname,
  'charset' => $config->database->charset
    );
    return new DbAdapter($config);
},true);
 
    $di->set('modelsManager', function() {
        return new Phalcon\Mvc\Model\Manager();
    });
 
/**
 * If the configuration specify the use of metadata adapter use it or use memory otherwise
 */
$di->set('modelsMetadata', function () {
    return new MetaDataAdapter();
});
 
/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () use ($config) {
    $session = new \Phalcon\Session\Adapter\Memcache((array) $config->memcache );
    $session->start();
 
    return $session;
}, true);
 
$di->set('cookies', function () {
    $cookies = new Phalcon\Http\Response\Cookies();
    $cookies->useEncryption(false);
    return $cookies;
}, true);
 
 
$di->set('flash', function(){
    $flash = new \Core\Flash\Session(array(
        'error'      => 'alert alert-danger alert-dismissible alert-fixed',
        'success'   => 'alert alert-success alert-dismissible alert-fixed',
        'notice'    => 'alert alert-info alert-dismissible alert-fixed',
  'warning'   => 'alert alert-warning alert-dismissible alert-fixed'
    ));
 
    return $flash;
},true);
 
$di->set('cacheManager', function()use($config){
    return new \Core\Cache\Manager($config);
},true);
 
 
$di->set('lang', function(){
    $lang = new Lang(array(
        'cache'         => null,
        'defaultLang'   => 'cz'
    ));
 
    return $lang;
},true);
 
 
$application = new \Phalcon\Mvc\Application($di);
$helper = new \Helper\Application($application);
//register routers and modules
$helper->registerModules();
$eventManager = new \Phalcon\Events\Manager();
 
//plugin loader
$pluginLoader = new \Plugin\Loader($application, $di, $config);
$pluginLoader->setPluginDirectory('../app/library/Plugin/');
$eventManager->attach('application', $pluginLoader);
 
//autoroute plugin
$autoRoutePlugin = new \Plugin\AutoRoute($eventManager);
$eventManager->attach('application', $autoRoutePlugin);
$eventManager->attach("dispatch",$autoRoutePlugin);
 
 
$application->setEventsManager($eventManager);
 
echo $application->handle()->getContent();
 
} catch (\Exception $e) {
    throw $e;
}
 
 
 
#1require_once(/var/www/web_ggm_new/app/bootstrap.php)
/var/www/web_ggm_new/public/index.php (30)
<?php
$allowedIp = array(
    '212.64.22.129'
);
ini_set("display_errors",1);
//
error_reporting(E_ALL);
$debug = new \Phalcon\Debug();
$debug->listen();
$ip = $_SERVER['REMOTE_ADDR'];
if(
    strpos($_SERVER['HTTP_HOST'],'loc.') !== false ||
    strpos($_SERVER['HTTP_HOST'],'development.') !== false ||
    strpos($_SERVER['HTTP_HOST'],'localhost') !== false)
{
    ini_set("display_errors",1);
    //
    error_reporting(E_ALL);
    $debug = new \Phalcon\Debug();
    $debug->listen();
    // Define development environment:
    define('ENVIRONMENT', '');
}
else {
    ini_set("display_errors",0);
    // Define production environment:
    define('ENVIRONMENT', 'production');
}
 
require_once '../app/bootstrap.php';
require "../vendor/autoload.php";
KeyValue
KeyValue
SCRIPT_URL/
SCRIPT_URIhttp://eduplay.app/
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_HOSTeduplay.app
HTTP_VIA1.1 squid-proxy-5b5d847c96-srpnh (squid/6.13)
HTTP_X_FORWARDED_FOR10.1.25.7
HTTP_CACHE_CONTROLmax-age=259200
HTTP_CONNECTIONkeep-alive
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2.4.10 (Debian)
SERVER_NAMEeduplay.app
SERVER_ADDR37.97.224.147
SERVER_PORT80
REMOTE_ADDR216.73.216.34
DOCUMENT_ROOT/var/www/web_ggm_new/public
REQUEST_SCHEMEhttp
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/var/www/web_ggm_new/public
SERVER_ADMIN[no address given]
SCRIPT_FILENAME/var/www/web_ggm_new/public/index.php
REMOTE_PORT1051
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
QUERY_STRING
REQUEST_URI/
SCRIPT_NAME/index.php
PHP_SELF/index.php
REQUEST_TIME_FLOAT1773215464.641
REQUEST_TIME1773215464
#Path
0/var/www/web_ggm_new/public/index.php
1/var/www/web_ggm_new/app/bootstrap.php
2/var/www/web_ggm_new/app/library/Assets.php
3/var/www/web_ggm_new/app/library/Core/Cache.php
4/var/www/web_ggm_new/app/library/Helper/Application.php
5/var/www/web_ggm_new/app/library/Core/Directory/Manager.php
6/var/www/web_ggm_new/app/library/Core/Directory/Reader.php
7/var/www/web_ggm_new/app/library/Core/String.php
Memory
Usage524288