We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon Migration to AWS Dev

I am able to migrate locally without any problems. But on my server when I try to migrate into AWS Remotely (It has permission) I get:

[email protected]:/var/www/site.com/htdocs# phalcon migration run PHP Warning: Module 'PDO' already loaded in Unknown on line 0

Phalcon DevTools (1.3.1)
Error: SQLSTATE[42000] [1049] Unknown database 'sitedb'

My PHP5 Mods Available in **/etc/php5/conf.d/*** are:

  • 20-curl.ini
  • 20-pdo.ini
  • 20-phalcon.ini
  • 20-mysqli.ini
  • 20-pdo_mysql.ini
  • 20-sqlite3.ini
  • 20-mysql.ini
  • 20-pdo_sqlite.ini

I am running Debian Wheezy, I checked for PDO in the /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini and got nothing it seems: [email protected]:/etc/php5/apache2# grep ^extension php.ini [email protected]:/etc/php5/apache2# grep -i pdo php.ini

[Pdo] ; https://php.net/pdo-odbc.connection-pooling ;pdo_odbc.connection_pooling=strict ;pdo_odbc.db2_instance_name [Pdo_mysql] ; https://php.net/pdo_mysql.cache_size pdo_mysql.cache_size = 2000 ; https://php.net/pdo_mysql.default-socket pdo_mysql.default_socket= [email protected]:/etc/php5/apache2#

Does anyone know what is wrong here?

please move 20-phalcon.ini to 30-phalcon.ini

Phalcon requires PDO loaded.

Hey, I've done this and reloaded Apache. However, the problem still persists where it cannot find the Database (I feel like it's looking for it locally).

$di->set('db', function () use ($di, $config) {
  $eventsManager = $di->getShared('eventsManager');
  $eventsManager->attach('db', new Event\Database());

  $database = new Phalcon\Db\Adapter\Pdo\Mysql((array) $config->database);

  return $database;

This is my config/config.php:

$config = new \Phalcon\Config([
  'title' => 'JREAM',
  'database' => [
    'adapter'     => 'Mysql',
    'host'        => 'localhost',
    'username'    => 'root',
    'password'    => '',
    'dbname'      => 'mydb'

//  Overwrite the configuration for LIVE version
if (file_exists('overwrite-config.php')) {
  require_once 'overwrite-config.php';

// This variable database credentials are overwritten by the file below
return $config;

my config/overwrite-config.php (Only for non-local-servers):

$config->database = [
  'adapter'     => 'Mysql',
  'host'        => 'AWS-Real-Credentials',
  'username'    => 'AWS-Real-Credentials',
  'password'    => 'AWS-Real-Credentials',
  'dbname'      => 'mydb'

Everything works great local and live to run. I still cannot migrate to the actual DB itself.