# Multiple sites error

**URL:** <https://community.open-emr.org/t/multiple-sites-error/7708>\
**Category:** OpenEMR Development\
**Created:** [October 25, 2012, 5:05pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708 "2012-10-25T17:05:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [October 25, 2012, 5:05pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/1 "2012-10-25T17:05:12Z")

</div>

**[rgvneil](https://sourceforge.net/u/rgvneil/)** wrote on [Thursday, October 25, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/f18fce83/#47cb):

Hello,  
if someone could help I’d sure appreciate it.  
I got this error even though as far as I know I followed the instructions, except i suppose for using 644 instead of chown at first…

–  
OpenEMR Setup

Step 3

Configuring OpenEMR…

Connecting to MySQL Server… OK.  
Creating database… OK.  
Creating user with permissions for database… OK.  
Reconnecting as new user… OK.  
Creating Main tables… OK  
Creating Language Translation (utf8) tables… OK  
Creating CVX Immunization Codes tables… OK  
Writing SQL configuration… unable to open configuration file for writing: /var/www/openemr/library/classes/…/…/sites/stmatthew/sqlconf.php

* * *

I did “chown -R www-data:www-data /var/www/openemr/sites” and got this for, and did chmod 644 for the setup.php, etc, etc in main directories…

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [October 25, 2012, 5:07pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/2 "2012-10-25T17:07:57Z")

</div>

**[rgvneil](https://sourceforge.net/u/rgvneil/)** wrote on [Thursday, October 25, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/f18fce83/#5d0b):

Also - I don’t see the option for clone existing database, which seems like it’d be awfully nice.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [October 26, 2012, 7:45am UTC](https://community.open-emr.org/t/multiple-sites-error/7708/3 "2012-10-26T07:45:19Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Friday, October 26, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/f18fce83/#1eec):

Hi,

Ensure you follow the instructions here:  
[http://open-emr.org/wiki/index.php/OpenEMR\_Multiple\_Sites\_Module#Installation\_of\_a\_new\_site](http://open-emr.org/wiki/index.php/OpenEMR_Multiple_Sites_Module#Installation_of_a_new_site)

-brady  
[OpenEMR](http://www.open-emr.org/)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [November 16, 2012, 8:49pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/4 "2012-11-16T20:49:12Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Friday, November 16, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/f18fce83/#66b6):

In Step 2 there is a “Clone Source Database” checkbox.

The error message likely indicates a problem with permissions.&nbsp; Try these at the command line and report the results:

ls -la /var/www/openemr/sites/default/  
ls -la /var/www/openemr/sites/stmatthew/

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 11, 2019, 6:06pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/5 "2019-09-11T18:06:17Z")

</div>

Ubuntu 18.04  
Mysql 5.7.27  
PHP 7.2x

Connecting to MySQL Server… **OK**.  
Creating database… **OK**.  
Creating user with permissions for database… **OK**.  
Reconnecting as new user… **OK**.  
Creating Main tables… OK  
Creating Language Translation (utf8) tables… OK  
Creating CVX Immunization Codes tables… OK

```
   Writing SQL configuration... **ERROR**. unable to open configuration file for writing: /var/www/html/emr1/library/classes/../../sites/Fairfax/sqlconf.php

```

Yes, I ran the command  
sudo chmod -R 666 /var/www/html/emr1/sites

Yes, mod-rewrite is on.

Yes, I read the instructions (Which are not many)

```
   https://www.open-emr.org/wiki/index.php/OpenEMR_Multiple_Sites_Module#Installation_of_a_new_site

```

I deleted and ran the script literally 7 times back to back.

Is there something else that could be missing?

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 13, 2019, 7:01am UTC](https://community.open-emr.org/t/multiple-sites-error/7708/6 "2019-09-13T07:01:07Z")

</div>

hi @juggernautsei ,

Anything in php error log?

After the failed install, what does the following show:

```auto
ls -al /var/www/html/emr1/sites/Fairfax

```

-brady

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 13, 2019, 10:33am UTC](https://community.open-emr.org/t/multiple-sites-error/7708/7 "2019-09-13T10:33:54Z")

</div>

After running the command it displays.  
ubuntu@ip-172-31-57-244:~$ ls -al /var/www/html/emr1/sites/Fairfax  
ls: cannot access ‘/var/www/html/emr1/sites/Fairfax’: Permission denied

Log

```
	[Wed Sep 11 17:31:32.813106 2019] [php7:warn] [pid 3730] [client 72.:61991] PHP Warning: include_once(): Failed opening '/var/www/html/emr1/library/classes/../../sites/Fairfax/sqlconf.php' for inclusion (include_path='/var/www/html/emr1/vendor/pear/archive_tar:/var/www/html/emr1/vendor/pear/console_getopt:/var/www/html/emr1/vendor/pear/pear-core-minimal/src:/var/www/html/emr1/vendor/pear/pear_exception:.:/usr/share/php') in /var/www/html/emr1/setup.php on line 225, referer: http://3.86.251.96/emr1/setup.php
	[Wed Sep 11 17:34:31.831143 2019] [php7:warn] [pid 3729] [client 72.:62033] PHP Warning: include_once(/var/www/html/emr1/library/classes/../../sites/Fairfax/sqlconf.php): failed to open stream: No such file or directory in /var/www/html/emr1/setup.php on line 225, referer: 

```

But I ran the sudo chmod -R 666 /var/www/html/emr1/sites to make the dir world writable.

Thanks, Brady!  
PS

I ran that command a level up and this is what I get

ubuntu@ip-172-31-57-244:~$ ls -al /var/www/html/emr1/sites  
total 16  
drwxrwxr-x 4 ubuntu ubuntu 4096 Sep 11 17:30 .  
drwxrwxr-x 27 ubuntu ubuntu 4096 Aug 4 01:13 …  
drw-rw-rw- 2 ubuntu ubuntu 4096 Sep 11 17:30 Fairfax  
drw-rw-rw- 5 ubuntu ubuntu 4096 Aug 4 01:13 default

If default and Fairfax has the same permission, why can’t the system write to Fairfax? Hummm.

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 13, 2019, 11:36am UTC](https://community.open-emr.org/t/multiple-sites-error/7708/8 "2019-09-13T11:36:32Z")

</div>

I got it to work by changing the mod to 777.

but now when I try to log into the instance it can’t be found  
[https://emr1/interface/login/login.php?site=Fairfax](https://emr1/interface/login/login.php?site=Fairfax)

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 13, 2019, 11:55am UTC](https://community.open-emr.org/t/multiple-sites-error/7708/9 "2019-09-13T11:55:39Z")

</div>

If AWS be sure that permissions aren’t being reset by any container startup scripts. Ensure case in your site names. I setup a 3 site multi last year on AWS were a script that checks permissions was rewriting but I though Brady or I fixed that. Just reverify after container up. Otherwise, multi works great in my experience.

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 13, 2019, 12:15pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/10 "2019-09-13T12:15:06Z")

</div>

> [@sjpadgett](#):
>
> container startup scripts

I am not using containers. This is a basic installation no docker.

How is the system suppose to work? Could you share that information please?

 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb265a607124e1f017c09004686e9cc0ce86c942.png)

When I click the arrow to login I get page not found.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 13, 2019, 1:35pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/11 "2019-09-13T13:35:15Z")

</div>

Linux is touchy on pathing names. Is your site directory named Fairfax? Verify if you can hit login from browser replacing site=default with site=Fairfax. Reverify sites/Fairfax permissions exactly match sites/default.  
Also, i’d expect some sort of error and check out what the url you are directed to in the browser console. Also, sometimes login encryption can get corrupted or out of sync. Try deleting sites/Fairfax/documents/logs\_and\_misc/methods/sixa and sixb. Should get a php error though.

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 13, 2019, 2:06pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/12 "2019-09-13T14:06:26Z")

</div>

Here are the permissions

```
	ubuntu@ip-172:~$ ls -al /var/www/html/emr1/sites/default total 112
	drwxrwxrwx 5 ubuntu ubuntu 4096 Aug 4 01:13 .
	drwxrwxrwx 4 ubuntu ubuntu 4096 Sep 11 17:30 ..
	drwxrwxrwx 2 ubuntu ubuntu 4096 Aug 4 01:13 LBF
	-rwxrwxrwx 1 ubuntu ubuntu 2302 Aug 4 01:13 clickoptions.txt
	-rwxrwxrwx 1 ubuntu ubuntu 3318 Aug 4 01:13 config.php
	-rwxrwxrwx 1 ubuntu ubuntu 2 Aug 4 01:13 docker-version
	drwxrwxrwx 14 ubuntu ubuntu 4096 Aug 4 01:13 documents
	-rwxrwxrwx 1 ubuntu ubuntu 392 Aug 4 01:13 faxcover.txt
	-rwxrwxrwx 1 ubuntu ubuntu 11218 Aug 4 01:13 faxtitle.eps
	drwxrwxrwx 2 ubuntu ubuntu 4096 Aug 4 01:13 images
	-rwxrwxrwx 1 ubuntu ubuntu 11451 Aug 4 01:13 referral_template.html
	-rwxrwxrwx 1 ubuntu ubuntu 649 Aug 25 12:23 sqlconf.php
	-rwxrwxrwx 1 ubuntu ubuntu 48249 Aug 4 01:13 statement.inc.php
	ubuntu@ip-172-:~$ ls -al /var/www/html/emr1/sites/Fairfax total 12
	drwxrwxrwx 2 ubuntu ubuntu 4096 Sep 13 11:33 .
	drwxrwxrwx 4 ubuntu ubuntu 4096 Sep 11 17:30 ..
	-rw-r--r-- 1 www-data www-data 653 Sep 13 11:33 sqlconf.php

```

There are no sub folders in the sites/Fairfax.  
Figured out that the contents of the default folder had not been copied to the Fairfax folder and now it works after doing that.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 13, 2019, 2:17pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/13 "2019-09-13T14:17:48Z")

</div>

I believe if multi is setup via setup.php then the default should have been copied though on this i’m not sure any longer.  
Still, glad ya got it worked out…

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 13, 2019, 2:57pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/14 "2019-09-13T14:57:58Z")

</div>

It should have because when I setup the third site with the folder permissions set to 777 and the owner set to www-data www-data. It copied everything and setup like it was suppose to the first time. Now I know.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 13, 2019, 3:58pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/15 "2019-09-13T15:58:28Z")

</div>

yep, i’m always having issues with user:group. Lately it’s been with vendor but, then again, I wouldn’t know what to do with myself if I weren’t befuddled about something. 🙂

---

<div class="post-metadata">

**Author:** ![stephenwaite](https://community.open-emr.org/user_avatar/community.open-emr.org/stephenwaite/32/15754_2.png) [@stephenwaite](https://community.open-emr.org/u/stephenwaite)\
**Post date:** [September 13, 2019, 4:41pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/16 "2019-09-13T16:41:44Z")

</div>

should be careful with permissions at 777, should only need read and execute for owner and write access for the documents subdirectory

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [September 28, 2019, 9:06pm UTC](https://community.open-emr.org/t/multiple-sites-error/7708/17 "2019-09-28T21:06:49Z")

</div>

I thought I updated this thread with the solution. The solution for me on this one was the web server settings. I had to change this:

```
<Directory /var/www/>
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

```

To this:

```
<Directory /var/www/>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
```
