Open algebris opened 11 years ago
@algebris After you setup your connection in common/config/environments/dev.php
and run:
php composer.phar self-update
php composer.phar install
And making sure that you type the dev
environment on request. Still having issues?
I have the same problem. Step to re produce
when echo db variable in backend app, it shows 'connectionString' => 'sqlite:C:\wamp\www\test_web\common\config/../data/testdrive.db'
I actually insert mysql connectionstring in common/config/env/dev.php It's seem that common/config/env folder is ignored from merging configuration process.
please give me some advice. Thanks
When you share common config make sure you REMOVE that setting from the backend / frontend / console (check your env.php on those places and also remove it from the environment config files)
Cheers
Enviado desde mi BlackBerry® de Vodafone
-----Original Message----- From: minkbear notifications@github.com Date: Wed, 15 May 2013 01:32:21 To: tonydspaniard/yiinitializr-advancedyiinitializr-advanced@noreply.github.com Reply-To: tonydspaniard/yiinitializr-advanced reply@reply.github.com Cc: Antonio Ramirezantonio@ramirezcobos.com Subject: Re: [yiinitializr-advanced] Install issue (#3)
I have the same problem. Step to re produce
when echo db variable in backend app, it shows 'connectionString' => 'sqlite:C:\wamp\www\test_web\common\config/../data/testdrive.db'
I actually insert mysql connectionstring in common/config/env/dev.php It's seem that common/config/env folder is ignored from merging configuration process.
please give me some advice. Thanks
Reply to this email directly or view it on GitHub: https://github.com/tonydspaniard/yiinitializr-advanced/issues/3#issuecomment-17926105
I have deleted backend/config/env.php frontend/config/env.php console/config/env.php api/config/env.php
and also deleted env folder backend/config/env frontend/config/env console/config/env api/config/env
now I have only configs belows: common/config/env.php common/config/env/dev.php common/config/env/prod.php
but backend app unable to connect database which config in common/config/env/dev.php
Thanks.
Make sure you remove the config for db at the environment folders too.
And then run the composer install again. Before, delete the composer.lock file and vendor folder.
OK.
I follow steps below as you mention and make sure that remove all the configs for db:
'connectionString' => 'sqlite:C:\wamp\www\test_web\common\config/../data/testdrive.db'
Thanks.
More info. I do var dump in Yiinitializr.config function. Below is output.
array(6) { [0]=> string(7) "backend" [1]=> string(59) "C:\wamp\www\test_web\backend\www/../../common/config/main.php" [2]=> string(58) "C:\wamp\www\test_web\backend\www/../../common/config/env.php" [3]=> string(60) "C:\wamp\www\test_web\backend\www/../../common/config/local.php" [4]=> string(3) "env" [5]=> string(5) "local" }
and look into Yiinitializr.build function. seem it does not merge common/config/env/.php or backend/config/env/.php
Thanks.
It does...
first the backend, then main, env, local, and last the env and local of backend config
Please, look for that connectionString to find out where is located
OK
I already searched all connectionString in backend, frontend, console, api, common but there are 2 connectionString section surely. 1 /common/config/main.php => sqlite 2 /common/config/env/dev.php => mysql
then i try to var dump in Yiinitializr.build function. the result is shown below:
input parameters to Yiinitializr.build function
array(6) {
[0]=> string(7) "backend"
[1]=> string(59) "C:\wamp\www\test_web\backend\www/../../common/config/main.php"
[2]=> string(58) "C:\wamp\www\test_web\backend\www/../../common/config/env.php"
[3]=> string(60) "C:\wamp\www\test_web\backend\www/../../common/config/local.php"
[4]=> string(3) "env"
[5]=> string(5) "local" }
var dump in Yiinitializr.build function
string(88) "C:\wamp\www\test_web\common\lib\Yiinitializr\config/../../../../backend/config/backend.php"
string(59) "C:\wamp\www\test_web\backend\www/../../common/config/main.php"
string(58) "C:\wamp\www\test_web\backend\www/../../common/config/env.php"
string(84) "C:\wamp\www\test_web\common\lib\Yiinitializr\config/../../../../backend/config/env.php"
then look in deep in that function (Yiinitializr.build)
foreach ($files as $file)
{
$config = file_exists($file) && is_file($file)
? require($file)
: (is_string($file) && file_exists($directory . '/' . $file . '.php')
? require($directory . '/' . $file . '.php')
: array());
if (is_array($config))
$result = ArrayX::merge($result, $config);
}
above function is not look into common/config/ env/{ENVIRONMENT}.php or backend/config/ env/{ENVIRONMENT}.php
ex. common/config/env/dev.php
My yiinitializr-advanced is fresh installed. Do I need add more config for Yiinitializr, or not?
Lets get back to basics:
Try to have one single point connection string: at the common/config/main.php. Remove the others! There is no need to have multiple connectionstrings for backend or frontend atm.
Make sure you only have one connectionstring.
Once you find out it works, lets upgrade, that means, try to connect to different database config on your env.php file (the file created by composer install
) for backend, and see if it overwrites the common
.
The key point is different environment make different database connection string. so i decided to save connection string in env/{ENVIRONMENT}.php ex. env/dev.php Example:
In dev environment the connection string should be in env/dev.php In prod environment the connection string sholud be in env/prod.php In test environment the connection string sholud be in env/test.php
How do you handle in this case? save connection string in env.php or dev.php? Please share your idea.
Hi, Antonio,
I'm getting this error: Failed to clone https://github.com/doctrine/common.git via git, https protocols, aborting.
Can you help me on this please?
Thanks
@minkbear if i work with one database for both backend / frontend and we have different environments. We do configure common/config/env/{dev|prod|stage}.php
, if we do have different DB for backend and/or frontend, then we place common configurations on common and databases on frontend|backend/config/env//{dev|prod|stage}.php
and if I wish to test locally a different configuration, then I make use of local.php
@flyzard Thats an issue with composer. Try to update the phar
file through php composer.phar self-update
, then delete the vendor
folder again and try it again... Sometimes it happens
If you are using MySQL, make sure you have the PHP mysql (PDO) extension installed.
Can't install, catching db connection exception. [CDbException]
CDbConnection failed to open the DB connection. i've just changed all config files like common/config/env.php, dev.php, prod.php in order to connect to database successfully but without result. What i'm doing wrong? Can't install it quickly