Jump to content

Prestashop With Remote Mysql Server, PDO error try to connect to localhost instead Server IP


Recommended Posts

Hi, another very strange BUG.

I'm tring to migrate one PS installation from nginx to apache due to TOTAL incompatibility with friendly url on nginx.

 

I've setup a new server with apache, rsync the data folder and setup all to work on the OLD mysql server to test. If all work great next i will switch the dns and use this configuration:

 

Server A: mysql, redis, elastichsearch 

Server B: webserver with apache

 

All work great after some works, except this error when we access the "catalogue" backend page:

PDO_MYSQL try to connect to 127.0.0.1 instead that the right server host ip provided in parameters.php (other site parts, and front office work right using the remote mysql server ip setting)!

 

 

This is the file

/*$dsn = '10.9.9.115';*/
    public function __construct($dsn, $user = null, $password = null, array $options = null)
    {
        try {
            parent::__construct($dsn, $user, $password, $options);
            $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
            $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (\PDOException $exception) {
            throw new PDOException($exception);
        }
    }
 

  1. in AbstractMySQLDriver.php line 103
  2. at AbstractMySQLDriver->convertException('An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused', object(PDOException)) in DBALException.php line 145
  3. at DBALException::driverException(object(Driver), object(PDOException)) in Driver.php line 47
  4. at Driver->connect(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => '', 'dbname' => 'Prestashop_1', 'user' => 'prestashop', 'password' => 'XXXXXXXXX', 'charset' => 'UTF8', 'driverOptions' => array('SET sql_mode=(SELECT REPLACE([spam-filter]sql_mode,'ONLY_FULL_GROUP_BY',''))'), 'serverVersion' => '5.1'), 'prestashop', 'XXXXXXXXXX', array('SET sql_mode=(SELECT REPLACE([spam-filter]sql_mode,'ONLY_FULL_GROUP_BY',''))')) in Connection.php line 360
  5. at Connection->connect() in Connection.php line 833
  6. at Connection->executeQuery('SELECT t0.id AS id_1, t0.employee AS employee_2, t0.shop AS shop_3, t0.controller AS controller_4, t0.action AS action_5, t0.filter AS filter_6 FROM ps_admin_filter t0 WHERE t0.employee = ? AND t0.shop = ? AND t0.controller = ? AND t0.action = ? LIMIT 1', array('1', '1', 'ProductController', 'catalogAction'), array('integer', 'integer', 'string', 'string')) in BasicEntityPersister.php line 712
  7. at BasicEntityPersister->load(array('employee' => '1', 'shop' => '1', 'controller' => 'ProductController', 'action' => 'catalogAction'), null, null, array(), null, '1', null) in EntityRepository.php line 196
  8. at EntityRepository->findOneBy(array('employee' => '1', 'shop' => '1', 'controller' => 'ProductController', 'action' => 'catalogAction')) in AdminProductDataProvider.php line 88
  9. at AdminProductDataProvider->getPersistedFilterParameters() in ProductController.php line 137
  10. at ProductController->catalogAction(object(Request), 'last', '0', 'last', 'desc')
  11. at call_user_func_array(array(object(ProductController), 'catalogAction'), array(object(Request), 'last', '0', 'last', 'desc')) in bootstrap.php.cache line 3246
  12. at HttpKernel->handleRaw(object(Request), '1') in bootstrap.php.cache line 3205
  13. at HttpKernel->handle(object(Request), '1', false) in bootstrap.php.cache line 3359
  14. at ContainerAwareHttpKernel->handle(object(Request), '1', false) in bootstrap.php.cache line 2562
  15. at Kernel->handle(object(Request), '1', false) in index.php line 86

 

 
 

 

Edited by Matteo
remove PW text (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...