Skip to content

Running php app/console strange database error #12278

@koemeet

Description

@koemeet

I have a Symfony2 application (2.6.x-dev, problem only occurs on 2.6.x) and I am running into some strange problems. If I delete the database that my application connects to and the run the following:

php app/console

It should display only a list of the commands I could run, but instead, it will throw the following error:

[PDOException]                                      
  SQLSTATE[HY000] [1049] Unknown database 'mango_db' 

Why is this happening? This way I can't run the php app/console doctrine:database:create command, because it throws this exception.

If I switch to Symfony 2.5.x-dev, the problem goes away and I can run php app/console.

Here a detailed stacktrace when I access it through the browser (maybe some helpful information).

PDOException in PDOConnection.php line 40:
SQLSTATE[HY000] [1049] Unknown database 'mango_db'
in PDOConnection.php line 40
at PDO->__construct('mysql:host=127.0.0.1;dbname=mango_db;charset=UTF8;', 'root', null, array()) in PDOConnection.php line 40
at PDOConnection->__construct('mysql:host=127.0.0.1;dbname=mango_db;charset=UTF8;', 'root', null, array()) in Driver.php line 41
at Driver->connect(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => null, 'dbname' => 'mango_db', 'user' => 'root', 'password' => null, 'charset' => 'UTF8', 'driverOptions' => array()), 'root', null, array()) in Connection.php line 356
at Connection->connect() in Connection.php line 680
at Connection->executeQuery('SELECT s0_.namespace AS namespace0, s0_.name AS name1, s0_.value AS value2, s0_.id AS id3 FROM sylius_settings_parameter s0_ WHERE s0_.namespace = ?', array('general'), array('2'), null) in SingleSelectExecutor.php line 50
at SingleSelectExecutor->execute(object(Connection), array('general'), array('2')) in Query.php line 286
at Query->_doExecute() in AbstractQuery.php line 794
at AbstractQuery->execute(null, '1') in AbstractQuery.php line 574
at AbstractQuery->getResult() in EntityRepository.php line 106
at EntityRepository->findBy(array('namespace' => 'general')) in SettingsManager.php line 190
at SettingsManager->getParameters('general') in SettingsManager.php line 103
at SettingsManager->loadSettings('general') in CurrencyContext.php line 41
at CurrencyContext->getDefaultCurrency() in CurrencyContext.php line 36
at CurrencyContext->__construct(object(Session), object(SecurityContext), object(SettingsManager), object(EntityManager)) in appDevDebugProjectContainer.php line 10918
at appDevDebugProjectContainer->getSylius_Context_CurrencyService() in bootstrap.php.cache line 2077
at Container->get('sylius.context.currency') in appDevDebugProjectContainer.php line 16331
at appDevDebugProjectContainer->getSylius_Templating_Helper_MoneyService() in bootstrap.php.cache line 2077
at Container->get('sylius.templating.helper.money') in appDevDebugProjectContainer.php line 18621
at appDevDebugProjectContainer->getTwigService() in bootstrap.php.cache line 2077
at Container->get('twig') in appDevDebugProjectContainer.php line 16526
at appDevDebugProjectContainer->getTemplatingService() in bootstrap.php.cache line 2077
at Container->get('templating') in appDevDebugProjectContainer.php line 9097
at appDevDebugProjectContainer->getNelmioApiDoc_Formatter_HtmlFormatterService() in bootstrap.php.cache line 2077
at Container->get('nelmio_api_doc.formatter.html_formatter') in appDevDebugProjectContainer.php line 9046
at appDevDebugProjectContainer->getNelmioApiDoc_EventListener_RequestService() in bootstrap.php.cache line 2077
at Container->get('nelmio_api_doc.event_listener.request') in classes.php line 4468
at ContainerAwareEventDispatcher->lazyLoad('kernel.request') in classes.php line 4436
at ContainerAwareEventDispatcher->getListeners('kernel.request') in TraceableEventDispatcher.php line 215
at TraceableEventDispatcher->preProcess('kernel.request') in TraceableEventDispatcher.php line 107
at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in bootstrap.php.cache line 2986
at HttpKernel->handleRaw(object(Request), '1') in bootstrap.php.cache line 2959
at HttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 3108
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 2353
at Kernel->handle(object(Request)) in app_dev.php line 31

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions