Phalcon Framework 3.4.1

PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

/home/frizerskaoprema/engine/frontend/bootstrap/services.php (41)
#0PDO->__construct(mysql:host=stella.raybear.com;dbname=mariner_sql;charset=utf8, mariner_web, Mariner#2018, Array([3] => 2))
#1Phalcon\Db\Adapter\Pdo->connect(Array([host] => stella.raybear.com, [username] => mariner_web, [password] => Mariner#2018, [dbname] => mariner_sql, [charset] => utf8))
#2Phalcon\Db\Adapter\Pdo->__construct(Array([host] => stella.raybear.com, [username] => mariner_web, [password] => Mariner#2018, [dbname] => mariner_sql, [charset] => utf8))
/home/frizerskaoprema/engine/frontend/bootstrap/services.php (41)
<?php
 
// ------------------------------------------------------------------------
// Mariner Store Application
// ------------------------------------------------------------------------
// Copyright (c) 2014-2015 Limit WABT (http://www.limit.rs)
// ------------------------------------------------------------------------
// This source file is subject to the LWC License that is bundled
// with this package in the file docs/licence.txt.
//
// If you did not receive a copy of the license and are unable to
// obtain it through the world-wide-web, please send an email
// to development@limit.rs so we can send you a copy immediately.
// ------------------------------------------------------------------------
 
// Declare namespaces to be used
use Phalcon\DI\FactoryDefault as DependencyInjection;
use Phalcon\Db\Adapter\Pdo\Mysql as MysqlAdapter;
use Phalcon\Mvc\View;
use Phalcon\Mvc\View\Engine\Volt;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Session as FlashSession;
 
// Create a DI ( Dependency Injection )
$di = new DependencyInjection();
 
// Add routing capabilities
$di->set( 'router', function() {
    require ENGINE_PATH . 'bootstrap/router.php';
    return $router;
});
 
// Set the database service
$di->set( 'db', function() use ( $config ) {
  return new MysqlAdapter( array(
    'host'     => $config->database->host,
    'username' => $config->database->username,
    'password' => $config->database->password,
    'dbname'   => $config->database->dbname,
        'charset' => 'utf8',
  ));
});
 
// Setting up the view component
$di->set( 'view', function() use ( $config ) {
  $view = new View();
  $view->setViewsDir( $config->application->views );
  $view->registerEngines( array(
    ".volt" => 'volt'
  ));
  return $view;
});
 
// Setting up volt engine
$di->set( 'volt', function( $view, $di ) {
  $volt = new Volt( $view, $di );
  $volt->setOptions( array(
    "compiledPath"   => ENGINE_PATH . "cache/volt/",
    "compileAlways" => true
  ));
  $compiler = $volt->getCompiler();
  $compiler->addFunction( 'is_a', 'is_a' );
  $compiler->addFunction( 'str_replace', 'str_replace' );
  $compiler->addFunction( 'mb_strtolower', 'mb_strtolower' );    
  return $volt;
}, true);
 
// Start the session the first time some component request the session service
$di->set( 'session', function() {
  $session = new SessionAdapter();
  $session->start();
  return $session;
});
 
// Register the flash service with custom CSS classes
$di->set( 'flash', function() {
  return new FlashSession( array(
    'error'   => 'alrt alrt-e',
    'success' => 'alrt alrt-s',
    'notice'  => 'alrt alrt-n',
  ));
});
#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(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)), null)
#8Phalcon\Mvc\Model\Manager->getReadConnection(Object(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)))
#9Phalcon\Mvc\Model->getReadConnection()
#10Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)), Object(Phalcon\Di\FactoryDefault))
#11Phalcon\Mvc\Model\MetaData->_initialize(Object(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)), categories-categories, categories, )
#12Phalcon\Mvc\Model\MetaData->readMetaData(Object(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)))
#13Phalcon\Mvc\Model\MetaData->hasAttribute(Object(Categories: [id] => (empty string), [name] => (empty string), [description] => (empty string), [image] => (empty string), [root] => (empty string), [visible] => (empty string), [featured] => (empty string), [order] => (empty string)), visible)
#14Phalcon\Mvc\Model\Query->_getQualified(Array([type] => 355, [name] => visible))
#15Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 355, [name] => visible), true)
#16Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 61, [left] => Array([type] => 355, [name] => visible), [right] => Array([type] => 258, [value] => 1)))
#17Phalcon\Mvc\Model\Query->_prepareSelect()
#18Phalcon\Mvc\Model\Query->parse()
#19Phalcon\Mvc\Model\Query->execute()
#20Phalcon\Mvc\Model::find(visible = 1)
/home/frizerskaoprema/engine/frontend/controllers/IndexController.php (27)
<?php
 
// ------------------------------------------------------------------------
// Mariner Store Application
// ------------------------------------------------------------------------
// Copyright (c) 2014-2015 Limit WABT (http://www.limit.rs)
// ------------------------------------------------------------------------
// This source file is subject to the LWC License that is bundled
// with this package in the file docs/licence.txt.
//
// If you did not receive a copy of the license and are unable to
// obtain it through the world-wide-web, please send an email
// to development@limit.rs so we can send you a copy immediately.
// ------------------------------------------------------------------------
 
// Declare namespaces to be used
use Phalcon\Paginator\Adapter\Model as PaginatorModel;
 
class IndexController extends Controller {
 
  public function initialize() {
    parent::initialize();
  }
 
  public function indexAction() {
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    $packages    = Packages::find('root = 0');
    
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    foreach( $packages as $p ) {
      array_push( $kw, $p->name );
    }
    $this->view->keywords = $kw;
    
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->packages  = $packages;
  }
 
  public function catalogAction() {
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    $products    = Products::find();
    
    // Prepare data for pagination
    $currentPage  = $this->request->getQuery('strana', 'int');;
    
    $paginator    = new PaginatorModel(
      array(
        'data'  => $products,
        'limit' => 20,
        'page'  => $currentPage
      )
    );
    $products    = $paginator->getPaginate();
 
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    foreach( $products->items as $p ) {
      array_push( $kw, $p->name );
    }
    $this->view->keywords = $kw;
 
    // Set page title
    $this->tag->appendTitle('Katalog proizvoda');
 
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->products  = $products;
  }
  
  public function packageAction() {
    // Get URL parameters
    $package_url  = $this->dispatcher->getParam('package');
 
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    $package    = Packs::findFirst( array(
      'name = :name:',
      'bind' => array( 'name' => $package_url )
    ));
 
    if(!$package) {
      $this->dispatcher->forward(array(
              'controller' => 'error',
              'action' => 'show404'
          ));
          return false;
    }
    
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    array_push( $kw, $package->name );
    $this->view->keywords = $kw;
 
    // Set page title
    $this->tag->appendTitle( $package->name );
 
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->package  = $package;
  }
  
  public function packagesAction() {
    // Get URL parameters
    $package_url  = $this->dispatcher->getParam('package');
    
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    $package    = Packages::findFirst( array(
      'name = :name:',
      'bind' => array( 'name' => $package_url )
    ));
    
    if(!$package) {
      $this->dispatcher->forward(array(
              'controller' => 'error',
              'action' => 'show404'
          ));
          return false;
    }
    
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    array_push( $kw, $package->name );
    $this->view->keywords = $kw;
    
    // Set page title
    $this->tag->appendTitle( $package->name );
 
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->package  = $package;
  }
  public function categoriesAction() {
    // Get URL parameters
    $category_url  = $this->dispatcher->getParam('category');
    
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    $category    = Categories::findFirst( array(
      'name = :name:',
      'bind' => array( 'name' => $category_url )
    ));
    
    if(!$category) {
      $this->dispatcher->forward(array(
              'controller' => 'error',
              'action' => 'show404'
          ));
          return false;
    }
    
    // Prepare data for pagination
    $currentPage  = $this->request->getQuery('strana', 'int');;
    $products     = Products::find(
        "category = '" . $category->id . "' OR alt_cat = '" . $category->id . "'"
    );
    
    $paginator    = new PaginatorModel(
      array(
        'data'  => $products,
        'limit' => 20,
        'page'  => $currentPage
      )
    );
    $products    = $paginator->getPaginate();
 
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    foreach( $products->items as $p ) {
      array_push( $kw, $p->name );
    }
    $this->view->keywords = $kw;
 
    // Set page title
    $this->tag->appendTitle( $category->name );
 
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->category  = $category;
    $this->view->products  = $products;
  }
  
  public function productsAction() {
    // Get URL parameters
    $product_url  = $this->dispatcher->getParam('product');
    
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
 
    $product    = Products::findFirst( array(
      "name = :name:",
      'bind' => array( 'name' => $product_url )
    ));
    
    if(!$product) {
      $this->dispatcher->forward(array(
              'controller' => 'error',
              'action' => 'show404'
          ));
    }
 
    // Set kw
    $kw  = $this->view->keywords;
    foreach( $categories as $c ) {
      array_push( $kw, $c->name );
    }
    array_push( $kw, $product->name );
    $this->view->keywords = $kw;
 
    // Set page title
    $this->tag->appendTitle( $product->name );
 
    // Parse data to view
    $this->view->categories  = $categories;
    $this->view->product  = $product;
  }
  
  public function contactAction() {
    // Set page title
    $this->tag->appendTitle('Kontakt');
    
    // Handle POST requeats
    if( $this->request->isPost() ) {
    
      $this->view->post = $this->request->getPost();
      
      // Handle AJAX requests
      if( $this->request->isAjax() ) {
      
        // Disable the view for AJAX response
        $this->view->disable();
        $data = array();
        $data['s'] = true;
        
        foreach ( $this->request->getPost() as $k => $v ) {
          if ( $v == '' && ( in_array( $k, array( 'name', 'email', 'type', 'message' ) ) ) ) {
            $data['m'][] = $k;
            $data['s'] = false;
          }
        }
        if ( $data['s'] ) {
          // Handle mail  
          $mail = new Mail();
          $mail->send(
            'frizerskaoprema@yahoo.com',
            'Novi kontant',
            'contact',
            array(
              'c' => $this->request->getPost()
            )
          );    
        } else {
          // Handle validation errors
          $data['s']      = false;
          $data['l']      = true;
        }
        $response = new \Phalcon\Http\Response();
        $response->setContent( json_encode( $data ) );
        return $response;
      }
    }
  }
  
  public function aboutAction() {
    // Set page title
    $this->tag->appendTitle('O nama');
 
    // Gather data from DB
    $categories    = Categories::find('visible = 1');
    
    // Parse data to view
    $this->view->categories  = $categories;
  }
}
#21IndexController->indexAction()
#22Phalcon\Dispatcher->callActionMethod(Object(IndexController), indexAction, Array())
#23Phalcon\Dispatcher->dispatch()
#24Phalcon\Mvc\Application->handle()
/home/frizerskaoprema/public_html/index.php (48)
<?php
 
// ------------------------------------------------------------------------
// Mariner Store Application
// ------------------------------------------------------------------------
// Copyright (c) 2014-2015 Limit WABT (http://www.limit.rs)
// ------------------------------------------------------------------------
// This source file is subject to the LWC License that is bundled
// with this package in the file docs/licence.txt.
//
// If you did not receive a copy of the license and are unable to
// obtain it through the world-wide-web, please send an email
// to development@limit.rs so we can send you a copy immediately.
// ------------------------------------------------------------------------
 
// Declare namespaces to be used
use \Phalcon\Config;
use \Phalcon\Mvc\Application;
 
// Control debug mode
$debug_mode = true;
if( $debug_mode ) {
  ini_set('display_errors', 1);
  $debug = new \Phalcon\Debug();
  $debug->listen();
}
 
// Set default timezone to UTC
date_default_timezone_set('Europe/Belgrade');
 
// Define paths
define( 'BASE_PATH',    realpath( '..' ) . '/' );
define( 'ENGINE_PATH',    BASE_PATH . 'engine/frontend/' );
define( 'PUBLIC_PATH',    BASE_PATH . 'public_html/' );
 
// Load the configuration file and process it
require( ENGINE_PATH . 'bootstrap/configuration.php' );
$config = new Config( $settings );
 
// Require Autoloader
require( ENGINE_PATH . 'bootstrap/loader.php' );
 
// Require Service declarations
require( ENGINE_PATH . 'bootstrap/services.php' );
 
// Handle the request
$application = new Application( $di );
$html = $application->handle()->getContent();
 
function sanitize_output( $buffer ) {
  $search = array(
    '/\>[^\S ]+/s',
    '/[^\S ]+\</s',
    '/(\s)+/s'
  );
  $replace = array(
    '>',
    '<',
    '\\1'
  );
  $buffer = preg_replace($search, $replace, $buffer);
  return $buffer;
}
 
ob_start("sanitize_output");
 
echo preg_replace( '/\s+/', ' ', $html );
KeyValue
KeyValue
UNIQUE_IDW6RBWsM1PNpG3LTnPLKUvwAAABs
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_IF_MODIFIED_SINCESat, 25 Nov 2017 05:05:40 MET
HTTP_HOSTwww.frizerskaoprema.rs
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2.4.6 (CentOS) PHP/5.6.37
SERVER_NAMEwww.frizerskaoprema.rs
SERVER_ADDR159.69.122.160
SERVER_PORT80
REMOTE_ADDR54.162.239.233
DOCUMENT_ROOT/home/frizerskaoprema/public_html
REQUEST_SCHEMEhttp
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/home/frizerskaoprema/public_html
SERVER_ADMINmilos@limit.rs
SCRIPT_FILENAME/home/frizerskaoprema/public_html/index.php
REMOTE_PORT56796
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
QUERY_STRING
REQUEST_URI/
SCRIPT_NAME/index.php
PHP_SELF/index.php
REQUEST_TIME_FLOAT1537491290.174
REQUEST_TIME1537491290
#Path
0/home/frizerskaoprema/public_html/index.php
1/home/frizerskaoprema/engine/frontend/bootstrap/configuration.php
2/home/frizerskaoprema/engine/frontend/bootstrap/loader.php
3/home/frizerskaoprema/engine/frontend/bootstrap/services.php
4/home/frizerskaoprema/engine/frontend/bootstrap/router.php
5/home/frizerskaoprema/engine/frontend/controllers/IndexController.php
6/home/frizerskaoprema/engine/frontend/controllers/Controller.php
7/home/frizerskaoprema/engine/frontend/models/Categories.php
Memory
Usage786432