Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1

I'm having trouble getting my subdomain to work with couchcms inside my main domain that also has its own couch cms.

I have a domain where my main website resides, e.g., and (where the couch cms is) and then I have set up a subdomain through my host called fwo. So it is, and the folder within public_html is fwo ( Then I have also installed couch cms in the subdomain folders as well.

When I go to it says "Could not connect to database Access denied for user 'user'@'localhost' (using password: YES). However if I put in the user details in config.php of the main domain admin the page loads. Which tells me it's looking for the main domain admin rather than the subdomain admin.

Is there something else I have to do when settying up the mysql database and user for subdomains?

I have also specified the url is config.php - define( 'K_SITE_URL', '' );

I have also tried changing this line in index.php to <?php require_once( 'fwo/admin/cms.php' ); ?>

Hope this all makes sense! Any help would be much appreciated!

The problem is that the MySQL creds you originally used in the sub-domain config are not right (please check phpMyAdmin or ask your host for the correct creds).

The MySQL creds being used by your main site, on the other hand, are of course definitely correct so when you placed those creds in config the sub-domain actually connected to the MySQL database of the main site.

Hence you'd be seeing all the data from the main site within the sub-domain installation as well - your main site installation and the sub-domain installation are both actually using the same database.

This can lead to both installations trampling over each other's data.
Please do the following to avoid it -

In the sub-domain's config (which at this point has identical MySQL creds as the main site), find the following setting and specify a unique prefix for the tables e.g. two_ as in the example below -
// 7b.
// Needed only if multiple instances of this CMS are to be installed in the same database
// (please use only alphanumeric characters, hyphen or underscore)
define( 'K_DB_TABLES_PREFIX', 'two_' );

Now when you'll visit the sub-domain's admin, Couch will connect to the same database as that of the main site *but* will look for tables with a different prefix. Since those won't be found, it will initiate a new installation.

This way both of your sites will coexist using the same database.

As for the the PHP statement required in all Couch templates, you need to use exactly the same one as that of the main site
Code: Select all
<?php require_once( 'admin/cms.php' ); ?>

Hope it helps.
2 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests