Phalcon Framework 3.4.5

PDOException: SQLSTATE[HY000] [2002] No such file or directory

/home/idporg/katalog.idp.org.tr/app/config/services.php (112)
#0PDO->__construct(mysql:host=localhost;dbname=idporg_katalog;charset=utf8, idporg_katalog, 963258741, Array([3] => 2))
#1Phalcon\Db\Adapter\Pdo->connect(Array([host] => localhost, [username] => idporg_katalog, [password] => 963258741, [dbname] => idporg_katalog, [charset] => utf8))
#2Phalcon\Db\Adapter\Pdo->__construct(Array([host] => localhost, [username] => idporg_katalog, [password] => 963258741, [dbname] => idporg_katalog, [charset] => utf8))
/home/idporg/katalog.idp.org.tr/app/config/services.php (112)
<?php
 
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\View;
use Phalcon\Crypt;
use Phalcon\Mvc\Dispatcher;
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\Files as MetaDataAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Direct as FlashDirect;
use Phalcon\Flash\Session as FlashSession;
use Phalcon\Logger\Adapter\File as FileLogger;
use Phalcon\Logger\Formatter\Line as FormatterLine;
use Phalcon\Breadcrumbs;
use Phalcon\Http\Response;
use Phalcon\Events\Manager as EventsManager;
use Phalcon\Cache\Frontend\Data as FrontendData;
use Phalcon\Cache\Backend\File as FileCache;
 
use Idp\Auth\Auth;
use Idp\Acl\Acl;
use Idp\Mail\Mail;
 
/**
 * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
 */
$di = new FactoryDefault();
 
/**
 * Register the global configuration as config
 */
$di->setShared('config', $config);
 
/**
 * The URL component is used to generate all kind of urls in the application
 */
$di->setShared('url', function () use ($config) 
{
    $url = new UrlResolver();
    $url->setBaseUri($config->application->baseUri);
    return $url;
});
 
/**
 * Setting up the view component
 */
$di->setShared('view', function () use ($config) 
{
    $view = new View();
    $view->setViewsDir($config->paths->views);
    $view->registerEngines(array(
        '.volt' => function ($view, $di) use ($config) {
 
            $volt = new VoltEngine($view, $di);
      
            $volt->setOptions(array(
                'compiledPath' => $config->paths->cache . 'volt/',
                'compiledSeparator' => '_',
                'compileAlways' => true
            ));
      
      $compiler = $volt->getCompiler();
      
      /**
       * New translate volt function
       *
       * Sample Usage:
       * _t(key, placeholders, default)
       * 
       */
       
      $compiler->addFunction('_t', function ($resolvedArgs, $exprArgs){
                return '_t(' . $resolvedArgs . ')';
            });
      
      $compiler->addFunction('urlTo', function ($resolvedArgs, $exprArgs){
                return 'urlTo(' . $resolvedArgs . ')';
            });
 
            $compiler->addFunction('in_array', 'in_array');
      
      /**
       * Custom Functions
       *
       * Sample Usage:
       * _func(key, params)
       * 
       */
      $compiler->addFunction('_func', function ($resolvedArgs, $exprArgs){
                return 'call_user_func(' . $resolvedArgs . ')';
            });
 
            return $volt;
        }
    ));
 
    return $view;
});
 
/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di->setShared('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
    ));
});
 
/**
 * If the configuration specify the use of metadata adapter use it or use memory otherwise
 */
$di->setShared('modelsMetadata', function () use ($config) 
{
    return new MetaDataAdapter(array(
        'metaDataDir' => $config->paths->cache . 'models/'
    ));
});
 
/**
 * Start the session the first time some component request the session service
 */
$di->setShared('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
 
/**
 * Crypt service
 */
$di->setShared('crypt', function () use ($config) 
{
    $crypt = new Crypt();
    $crypt->setKey($config->application->cryptSalt);
    return $crypt;
});
 
/**
 * Dispatcher use a default namespace
 */
$di->setShared('dispatcher', function () 
{
    $dispatcher = new Dispatcher();
    $dispatcher->setDefaultNamespace('Idp\Controllers');
    return $dispatcher;
});
 
/**
 * Loading routes from the routes.php file
 */
$di->setShared('router', function () use ($config) 
{
    return require __DIR__ . '/routes.php';
});
 
/**
 * Flash service with custom CSS classes
 */
$di->setShared('flash', function () 
{
    $flashDirect = new FlashDirect(array(
        'error' => 'notification error closeable',
        'success' => 'notification success closeable',
        'notice' => 'notification notice closeable',
        'warning' => 'notification warning closeable'
    ));
    
    $flashDirect->setAutoescape(false);
    
    return $flashDirect;
});
 
/**
 * Flash service with session
 */
$di->setShared('flashdata', function () 
{
  $flashdata = new FlashSession(array(
        'error' => 'notification error closeable',
        'success' => 'notification success closeable',
        'notice' => 'notification notice closeable',
        'warning' => 'notification warning closeable'
    ));
    
    $flashdata->setAutoescape(false);
    
    return $flashdata;
});
 
/**
 * Custom authentication component
 */
$di->setShared('auth', function () 
{
    return new Auth();
});
 
/**
 * Mail service
 */
$di->setShared('mail', function () 
{
    return new Mail();
});
 
/**
 * Logger service
 */
$di->setShared('logger', function($message = null) use ($config) 
{
    $format   = $config->get('logger')->format;
    $filename = date('Y-m-d') . '.log';
    $path     = rtrim($config->get('logger')->path, '\\/') . DS;
 
    $formatter = new FormatterLine($format, $config->get('logger')->date);
    $logger    = new FileLogger($path . $filename);
 
    $logger->setFormatter($formatter);
    $logger->setLogLevel($config->get('logger')->logLevel);
 
    return $logger;
});
 
// Initialize the Breadcrumbs component.
$di->setShared('breadcrumbs', function () 
{
  $breadcrumbs = new Breadcrumbs();
  
  $breadcrumbs
      ->setSeparator('')
      ->setTemplate(
          '<li><a href="{{link}}">{{icon}}{{label}}</a></li>',   // linked
          '<li class="active">{{icon}}{{label}}</li>',           // not linked
          '<i class="icon-home2 position-left"></i>'        // first icon
        );
  
    return $breadcrumbs;
});
 
 
/**
 * Response
 */
$di->setShared('response', function () 
{
    return new Response();
});
 
/**
 * EventsManager
 */
$di->setShared('events', function () 
{
  return require __DIR__ . '/events.php';
});
 
 
/**
 * Translate
 */
$di->setShared('trans', function() use($di, $config) 
{
    $session   = $di->getShared('session');
    $request   = $di->getShared('request');
    $dispatcher  = $di->getShared('dispatcher');
 
  // Get entered language.
  if($language = $dispatcher->getParam('lang'))
  {
    if(array_key_exists($language, $config->languages))
    {
      $session->set("lang", $language);
    }
    else
    {
      $session->set("lang", $config->application->language);
    }
  }
  else
  {  
    // Get language code
    if($session->has("lang")) 
    {
      $language = $session->get("lang");
    } 
    else 
    {
      // Ask browser what is the best language
      $language = $config->application->language;
      $session->set("lang", $language);
    }
  }
 
    // Check if we have a translation file for that language
    if(file_exists(APP_PATH . DS. "messages/{$language}.php")) 
  {
        $t = require APP_PATH . DS. "messages/{$language}.php";
    } 
  else 
  {
        // Fallback to default language
        $t = require APP_PATH . DS . "messages/{$config->application->language}.php";
    }
 
    unset($language);
 
    // Return a translation object
    return new \Phalcon\Translate\Adapter\NativeArray(array(
        "content" => $t
    ));
});
 
 
/**
 * Models Cache
 */
$di->setShared(
    "modelsCache",
    function () use ($config) 
    {
        // Cache data for one day by default
        $frontCache = new FrontendData(
            [
                "lifetime" => 86400,
            ]
        );
        
        $cache = new FileCache(
            $frontCache,
            [
                "cacheDir" => $config->paths->cache . 'queries/',
            ]
        );
 
        return $cache;
    }
);
#3Closure->{closure}()
#4Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#5Phalcon\Di->get(db, null)
#6Phalcon\Di->getShared(db)
#7Phalcon\Mvc\Model\Manager->_getConnection(Object(Idp\Models\Pages: 11), null)
#8Phalcon\Mvc\Model\Manager->getReadConnection(Object(Idp\Models\Pages: 11))
#9Phalcon\Mvc\Model->getReadConnection()
#10Phalcon\Mvc\Model\Query->getReadConnection(Object(Idp\Models\Pages: 11), Array([models] => Array([0] => Idp\Models\Pages), [tables] => Array([0] => pages), [columns] => Array([idp\Models\Pages] => Array([type] => object, [model] => Idp\Models\Pages, [column] => pages, [balias] => idp\Models\Pages)), [where] => Array([type] => binary-op, [op] => AND, [left] => Array([type] => parentheses, [left] => Array()), [right] => Array([type] => parentheses, [left] => Array())), [order] => Array([0] => Array([0] => Array(), [1] => ASC))), Array([status] => 1), null)
#11Phalcon\Mvc\Model\Query->_executeSelect(Array([models] => Array([0] => Idp\Models\Pages), [tables] => Array([0] => pages), [columns] => Array([idp\Models\Pages] => Array([type] => object, [model] => Idp\Models\Pages, [column] => pages, [balias] => idp\Models\Pages)), [where] => Array([type] => binary-op, [op] => AND, [left] => Array([type] => parentheses, [left] => Array()), [right] => Array([type] => parentheses, [left] => Array())), [order] => Array([0] => Array([0] => Array(), [1] => ASC))), Array([status] => 1), null)
#12Phalcon\Mvc\Model\Query->execute()
#13Phalcon\Mvc\Model::find(Array([di] => Object(Phalcon\Di\FactoryDefault), [conditions] => (status = :status:) AND (parent_id IS NULL), [bind] => Array([status] => 1), [order] => Idp\Models\Pages.sort ASC))
#14Phalcon\Mvc\Model\Criteria->execute()
/home/idporg/katalog.idp.org.tr/app/models/Pages.php (59)
<?php
namespace Idp\Models;
 
class Pages extends BaseModel
{
    public $id;
    public $parent_id;
    public $title;
    public $alias;
    public $content;
    public $is_link;
    public $sort;
    public $views;
    public $status;
    public $created;
    public $updated;
  
    public function initialize() 
  {
    $this->belongsTo('parent_id', __NAMESPACE__ . '\Pages', 'id', array(
            'alias' => 'parent',
            'reusable' => true
        ));
        
        $this->hasMany('id', __NAMESPACE__ . '\Pages', 'parent_id', array(
            'alias' => 'children',
            'reusable' => true,
            'params' => array(
                            'order' => 'sort ASC',
                            "status = 1"
                        )
        ));
  }
  
  public function afterFetch()
  {
        // Get Services
        $config = \Phalcon\Di::getDefault()->getConfig();
        $url = \Phalcon\Di::getDefault()->getUrl();
        
        // URL
        $this->url      = $url->get("{$this->alias}");
        $this->url_edit = $url->get("panel/sayfa/{$this->id}");
        
    $this->created_time = strtotime($this->created);
    $this->updated_time = !empty($this->updated) ? strtotime($this->updated) : NULL;
  }
    
    public static function getActivePages()
    {
    $tbl = __NAMESPACE__ . '\Pages';
    
    return self::query()
          ->where('status = :status:')
          ->andWhere('parent_id IS NULL')
          ->bind(['status' => true])
          // ->columns(["{$tbl}.id", "{$tbl}.icon", "sk.name", "sk.slug", "sk.description"])
          ->orderBy("{$tbl}.sort ASC")
          ->execute();
    }
}        
#15Idp\Models\Pages::getActivePages()
/home/idporg/katalog.idp.org.tr/app/controllers/ControllerBase.php (25)
<?php
namespace Idp\Controllers;
 
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;
 
use Idp\Models\Pages;
use Idp\Models\UsersActivitiesLogs;
 
class ControllerBase extends Controller
{
    public function beforeExecuteRoute(Dispatcher $dispatcher)
    {
        $identity = $this->auth->getIdentity();
        
        if($this->auth->isLogged()) 
    {
            $logged_user = $this->auth->getUser();
            $this->checkUserActivity($logged_user);
        }
    
        $this->view->setVar('is_homepage', false);
        $this->view->setVar('is_panel', false);
        $this->view->setVar('identity', $identity);
        $this->view->setVar('menu_items',  Pages::getActivePages());
 
    $this->view
          ->setViewsDir($this->config->paths->views)
                    ->setLayoutsDir($this->config->paths->views . DS . $this->config->paths->layouts)
          ->setPartialsDir($this->config->paths->partials)
          ->setTemplateBefore('public');
    }
    
    private function checkUserActivity($user)
    {
        // Get session refresh time
        $session_refresh = $this->config->application->session_refresh;
        
        // Get the activity        
        $activity = UsersActivitiesLogs::findFirst(
            [
                "conditions" => "user_id = :user_id: AND end_time >= :end_time:",
                "bind"       => ['user_id' => $user->id, 'end_time' => time() - $session_refresh]
            ]
        );
        
        if($activity)
        {
            $activity->update(['end_time' => time() + 10]);
        }
        else
        {
            $activity = new UsersActivitiesLogs();
            $activity->create(['user_id' => $user->id, 'start_time' => time(), 'end_time' => time() + 10]);
        }
    }
}
#16Idp\Controllers\ControllerBase->beforeExecuteRoute(Object(Phalcon\Mvc\Dispatcher))
#17Phalcon\Dispatcher->dispatch()
#18Phalcon\Mvc\Application->handle()
/home/idporg/katalog.idp.org.tr/public/index.php (62)
<?php
 
/**
 * Set Locate
 */
setlocale(LC_COLLATE, 'turkish', 'tr_TR.UTF-8', 'tr_TR', 'tr');
setlocale(LC_MONETARY, 'turkish', 'tr_TR.UTF-8', 'tr_TR', 'tr');
setlocale(LC_NUMERIC, 'turkish', 'tr_TR.UTF-8', 'tr_TR', 'tr');
setlocale(LC_TIME, 'turkish', 'tr_TR.UTF-8', 'tr_TR', 'tr');
setlocale(LC_CTYPE,'en_US.utf8');
// setlocale(LC_MESSAGES,'tr_TR.utf8');
 
/**
 * Set Time Zone
 */
date_default_timezone_set('Europe/Istanbul');
 
 
/**
 * Define some useful constants
 */
define('DOT', '.');
define('DS', DIRECTORY_SEPARATOR);
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . DS. 'app');
define('PUBLIC_PATH', BASE_PATH . DS . 'public');
 
/**
 * Read the constants
 */
$config = include APP_PATH . '/config/constants.php';
 
/**
 * Read the configuration
 */
$config = include APP_PATH . '/config/config.php';
 
/**
 * Read auto-loader
 */
include APP_PATH . '/config/loader.php';
 
/**
 * Read services
 */
include APP_PATH . '/config/services.php';
 
// Debug Application
if($config->application->debug)
{
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
 
    (new Phalcon\Debug)->listen();    
    
    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);
    
    echo $application->handle()->getContent();
}
else
{
    try
    {
        /**
         * Handle the request
         */
        $application = new \Phalcon\Mvc\Application($di);
 
        echo $application->handle()->getContent();
    }
    catch(Exception $e)
    {
        $di->getLogger()->error($e->getMessage());
     
        echo $e->getMessage(), '<br>';
        echo nl2br(htmlentities($e->getTraceAsString()));
        exit;
    }
}
KeyValue
_url/yazilar/67123/ilm-i-ledun
KeyValue
CONTEXT_DOCUMENT_ROOT/home/idporg/katalog.idp.org.tr
CONTEXT_PREFIX
DOCUMENT_ROOT/home/idporg/katalog.idp.org.tr
GATEWAY_INTERFACECGI/1.1
HTTP_ACCEPT*/*
HTTP_HOSTkatalog.idp.org.tr
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
PATH/bin:/usr/bin
QUERY_STRING_url=/yazilar/67123/ilm-i-ledun
REDIRECT_QUERY_STRING_url=/yazilar/67123/ilm-i-ledun
REDIRECT_REDIRECT_SCRIPT_URIhttp://katalog.idp.org.tr/yazilar/67123/ilm-i-ledun
REDIRECT_REDIRECT_SCRIPT_URL/yazilar/67123/ilm-i-ledun
REDIRECT_REDIRECT_STATUS200
REDIRECT_REDIRECT_UNIQUE_IDZiwPKB42d3kFbXNWy7BuFAAAANI
REDIRECT_SCRIPT_URIhttp://katalog.idp.org.tr/yazilar/67123/ilm-i-ledun
REDIRECT_SCRIPT_URL/yazilar/67123/ilm-i-ledun
REDIRECT_STATUS200
REDIRECT_UNIQUE_IDZiwPKB42d3kFbXNWy7BuFAAAANI
REDIRECT_URL/public/yazilar/67123/ilm-i-ledun
REMOTE_ADDR18.118.126.241
REMOTE_PORT44404
REQUEST_METHODGET
REQUEST_SCHEMEhttp
REQUEST_URI/yazilar/67123/ilm-i-ledun
SCRIPT_FILENAME/home/idporg/katalog.idp.org.tr/public/index.php
SCRIPT_NAME/public/index.php
SCRIPT_URIhttp://katalog.idp.org.tr/yazilar/67123/ilm-i-ledun
SCRIPT_URL/yazilar/67123/ilm-i-ledun
SERVER_ADDR178.157.15.166
SERVER_ADMINwebmaster@katalog.idp.org.tr
SERVER_NAMEkatalog.idp.org.tr
SERVER_PORT80
SERVER_PROTOCOLHTTP/1.1
SERVER_SIGNATURE
SERVER_SOFTWAREApache
TZEurope/Istanbul
UNIQUE_IDZiwPKB42d3kFbXNWy7BuFAAAANI
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1714163496,7787
REQUEST_TIME1714163496
argvArray([0] => _url=/yazilar/67123/ilm-i-ledun)
argc1
#Path
0/home/idporg/katalog.idp.org.tr/public/index.php
1/home/idporg/katalog.idp.org.tr/app/config/constants.php
2/home/idporg/katalog.idp.org.tr/app/config/config.php
3/home/idporg/katalog.idp.org.tr/app/config/loader.php
4/home/idporg/katalog.idp.org.tr/vendor/autoload.php
5/home/idporg/katalog.idp.org.tr/vendor/composer/autoload_real.php
6/home/idporg/katalog.idp.org.tr/vendor/composer/ClassLoader.php
7/home/idporg/katalog.idp.org.tr/vendor/composer/autoload_static.php
8/home/idporg/katalog.idp.org.tr/vendor/symfony/polyfill-mbstring/bootstrap.php
9/home/idporg/katalog.idp.org.tr/vendor/symfony/var-dumper/Resources/functions/dump.php
10/home/idporg/katalog.idp.org.tr/vendor/guzzlehttp/psr7/src/functions_include.php
11/home/idporg/katalog.idp.org.tr/vendor/guzzlehttp/psr7/src/functions.php
12/home/idporg/katalog.idp.org.tr/vendor/swiftmailer/swiftmailer/lib/swift_required.php
13/home/idporg/katalog.idp.org.tr/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
14/home/idporg/katalog.idp.org.tr/vendor/snowair/phalcon-debugbar/src/Debug.php
15/home/idporg/katalog.idp.org.tr/app/config/helpers.php
16/home/idporg/katalog.idp.org.tr/app/helpers/base.php
17/home/idporg/katalog.idp.org.tr/app/helpers/core.php
18/home/idporg/katalog.idp.org.tr/app/helpers/image.php
19/home/idporg/katalog.idp.org.tr/app/helpers/url.php
20/home/idporg/katalog.idp.org.tr/app/config/services.php
21/home/idporg/katalog.idp.org.tr/app/config/routes.php
22/home/idporg/katalog.idp.org.tr/app/controllers/ArticlesController.php
23/home/idporg/katalog.idp.org.tr/app/controllers/ControllerBase.php
24/home/idporg/katalog.idp.org.tr/app/library/Auth/Auth.php
25/home/idporg/katalog.idp.org.tr/app/models/Pages.php
26/home/idporg/katalog.idp.org.tr/app/models/BaseModel.php
27/home/idporg/katalog.idp.org.tr/app/cache/models/map-idp_models_pages.php
28/home/idporg/katalog.idp.org.tr/app/cache/models/meta-idp_models_pages-pages.php
Memory
Usage2097152