In localhost, symfony console doctrine:database:create
runs perfectly.But when I try to install the project for production on Ubunthu server, that does not work.
I have a .env file with vars like :
.env
###> symfony/framework-bundle ###APP_ENV=%APP_ENV%APP_SECRET=%APP_SECRET%###< symfony/framework-bundle ######> doctrine/doctrine-bundle ###DATABASE_URL="mysql://%DB_USER%:%DB_PASS%@%DB_SERVER%/%DB_DBNAME%?serverVersion=%DB_VERSION%&charset=utf8mb4"###< doctrine/doctrine-bundle ######> nelmio/cors-bundle ###CORS_ALLOW_ORIGIN='%CORS_ALLOW_ORIGIN%'###< nelmio/cors-bundle ###
and
.env.prod
APP_ENV=prodAPP_SECRET=xxxxxxxCORS_ALLOW_ORIGIN=^https?://(admin.|)(example.com)(:[0-9]+)?$DB_USER=xxxxxDB_PASS=xxxxDB_SERVER=xxxxx:3306DB_DBNAME=mydbnameDB_VERSION=10.11.2-MariaDB
I´m trying to run symfony console doctrine:database:create
but by ssh that does not work and I got this error :
[critical] Error thrown while running command "doctrine:database:create". Message: "Malformed parameter "url"."In ConnectionFactory.php line 262:Malformed parameter "url".
In MalformedDsnException.php line 12:Malformed database connection URL
doctrine:database:create [-c|--connection [CONNECTION]] [--if-not-exists]
even if I try to set each var before like...
export DB_USER=foo
So what is the best way to deploy on production... run easily
symfony console doctrine:database:createsymfony console doctrine:schema:create
.. and Symfony/doctrine can interprates .env with vars without I need to gitignore doctrine.yaml
and .env
?