Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

2 sites - config.php database settings ignored - dev/build still loads


Go to End


3 Posts   1604 Views

Avatar
acktivate

Community Member, 11 Posts

20 October 2013 at 7:16pm

I am running two sites on 3.0.5 and using symbolic links. The dev site database settings are ignored in mysite/_config.php and uses the production database settings. I know this because when I ran a dev/build on the dev site, the page loaded with no errors but displayed the production database name at the top.

www.domain.com and dev.domain.com

In the mysite/_config.php,

each site has a unique username, database name and password.

www.domain.com
un: prod_db_admin
db name: prod_db
pw: ***

dev.domain.com
un: dev_db_admin
db name: dev_db
pw: ***

I added 2 new PHP files mysite/code on dev.domain.com and I ran dev/build on dev.domain.com, the page loaded with no errors and the message at the top says "Building database prod_db using MySQL 5.1.56-log."

I logged into www.domain.com/admin/ and added a page to the CMS and then logged into dev.domain.com/admin/ and the new page appears there as well.

The 2 new PHP files do not exist on mysite/code on www.domain.com yet when I review the dev/build results from the prod_db, the new tables are listed that were created by the 2 new PHP files from the dev site.

I deleted the silverstripe-cache folders on both sites and recreated.

thoughts?

Avatar
Bambii7

Community Member, 254 Posts

21 October 2013 at 11:57am

Hi acktivate,

I don't quite understand the set up. Do you have a dev and prod site symbolically linked on the same server? Won't that defeat the purpose of a dev site if the code base is the same as prod?

How are you handling the environment detection?
Something like?

if( $_SERVER['HTTP_HOST'] ) {
MY DB
}

Avatar
acktivate

Community Member, 11 Posts

21 October 2013 at 5:34pm

I am using symbolic links for the framework files (cms, framework, userforms, etc) The mysite, themes, and mysite/_config.php files are different.

I resolved this issue by deleting dev.domain.com and rebuilding from scratch.