Multiple sites error

rgvneil wrote on Thursday, October 25, 2012:

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…

rgvneil wrote on Thursday, October 25, 2012:

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

bradymiller wrote on Friday, October 26, 2012:

Hi,

Ensure you follow the instructions here:
http://open-emr.org/wiki/index.php/OpenEMR_Multiple_Sites_Module#Installation_of_a_new_site

-brady
OpenEMR

sunsetsystems wrote on Friday, November 16, 2012:

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

The error message likely indicates a problem with permissions.  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

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?

hi @juggernautsei ,

Anything in php error log?

After the failed install, what does the following show:

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

-brady

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.

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

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.

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?

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

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.

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.

1 Like

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…

1 Like

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.

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. :slight_smile:

1 Like

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

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>