1
votes

I have some problem while configuring symfony project on the production server. When I run the command doctrine --build --all --and-load it gives me error in the production environment:

   
>> doctrine  Dropping "doctrine" database
PHP Notice:  Undefined index:  dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1472

Notice: Undefined index:  dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1472
>> doctrine  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an erro...e right syntax to use near '' at line 1. Failing Query: "DROP DATABASE "
>> doctrine  Creating "dev" environment "doctrine" database
PHP Notice:  Undefined index:  dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1439

However after the error it creates the table successfully. But if I run the command second times it fails partially while crating the tables.

I have changed my database.yml configuration properly for the production environment. here it is:

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn: mysql:host=localhost;dbname=sf_project
      port: 3306
      username: root
      password: mainserver

Its working right in the local environment though. Can some one shed some light on it ?

Editing note: added the content of '/cache//prod/config/config_databases.yml.php' file as 'xzyfer' suggested.

Here's the content :


return array(
'doctrine' => new sfDoctrineDatabase(array (
  'dsn' => 'mysql:host=localhost; dbname=sf_project',
  'port' => 3306,
  'username' => 'root',
  'password' => 'mainserver',
  'name' => 'doctrine',
)),);

1

1 Answers

1
votes

try:

./symfony doctrine:build --all --and-load --env=prod