Multi-site setup: unable to move past Optional Site ID Selection

@stephenwaite see this:

I am able to get to step 3 with both patch 1 and patch 2 of OpenEMR version 7.0.0

I am using a development environment:
XAMPP with php8.1
windows 10

I see that @athenaortiz has been able to get past the issue.

Reinstalling OpenEMR is not hard. Just rename the current directory to “openemr_old” or something like that so as not to lose your “sites” directory and reinstall after doing checksum. If your initial download is corrupt, other problems will occur later on.

You may run setup again to after reinstalling openemr, but then you will have to drop your databases (I don’t recommend this), or use different database names. This is a problem if you already have data in your databases. Another option is to do the following:

If you have more than one site, then copy and paste openemr/sites/default as many times as your need. You will wind up with something like this:

openemr/sites/defaut
openemr/sites/defaut copy
openemr/sites/defaut copy(1)
openemr/sites/defaut copy(2)

Rename the directories as needed:

openemr/sites/defaut
openemr/sites/site1
openemr/sites/site2
openemr/sites/site3

The reason I do it this way is in case changes have been made with previous patches. In your case, you can probably just copy the whole sites directory from your old installation (I don’t recommend it because of the corruption issue). But in my case, my installation is old and I have been updating it and patching it over time. Also, in your case, if you have a corrupt installation, you may have corrupt or missing files in the original default directory.

Do the following for each of your sites. Again, notepad++ is safe for editing files.

Edit sqlconf.php in openemr/sites/default with notepad++ to make it work with your default database

and 

Copy openemr/sites/default/documents/logs_and_misc/methods/sixa and sixb to the same location in your new install.

finally, copy all your directories that begin with a number in:

openemr_old/sites/default/documents
openemr_old/sites/site1/documents
openemr_old/sites/site2/documents
openemr_old/sites/site3/documents

to your new openemr install.

Then try again to use the multisite and cloning feature in setup.php. But remember to save setup.php prior to applying patches, because patching it deletes the text in it!

Once you are done with all this, going to the admin page should work. Let me know if it doesn’t

1 Like

Do I need to go through the initial setup or do I just move my old default sites directory into the new OpenEMR directory?

No, no need to go through initial setup. But also, don’t just the whole sites directory.

Let me expand on the message above for the documents.

Ok, I have explained how I would do it (in fact, I did it today while attempting to troubleshoot the cloning feature.)
Let me know if you have more questions.

1 Like

Thanks for the details Sandra, I’ll let you know how this turns out.

1 Like

Ok, so I followed your instructions, but now when trying to set up a second site (cloning from default site database) I get the following message at step 3:

I also see this when on the admin page:

When I click “Needs setup, click here to run it” I’m taken to the standard installation page. I’m not sure what it wants me to setup. I’m able to login to my default site just fine.

I was able to setup my second site by letting setup create a brand new database, rather than cloning my default one. I’m unable to login to the new site though. I get this error:

This is line 519 from the file mentioned in the error:

// Migrated this to populate after the standard globals in order to support globals that require
//  more security.
require_once($GLOBALS['OE_SITE_DIR'] . "/config.php");

This file is missing from the directory of my new site.

Also noticed there are several files missing from the new site directory as opposed to the default directory. I assumed that these files would be added/created during the setup. Do I need to copy the missing files from the default directory into the new one?

Default site directory:

Second site directory:

hi @athenaortiz , it has to go through perfectly on the first step or else you have to back up and drop the newly created database and remove the newly created site directory and try again.

once that’s done it will look something like this

/var/www/localhost/htdocs # tree openemr/sites/
openemr/sites/
├── default
│   ├── LBF
│   │   ├── LBFathbf.plugin.php
│   │   ├── LBFathv.plugin.php
│   │   ├── LBFfms.plugin.php
│   │   ├── LBFgcac.plugin.php
│   │   ├── LBFvbf.plugin.php
│   │   └── LBTref.plugin.php
│   ├── clickoptions.txt
│   ├── config.php
│   ├── docker-version
│   ├── documents
│   │   ├── certificates
│   │   │   └── README.md
│   │   ├── couchdb
│   │   │   └── README
│   │   ├── custom_menus
│   │   │   ├── Custom.json
│   │   │   └── patient_menus
│   │   │       └── Custom.json
│   │   ├── edi
│   │   │   └── README.txt
│   │   ├── era
│   │   │   └── README.txt
│   │   ├── letter_templates
│   │   │   └── sample
│   │   ├── logs_and_misc
│   │   │   └── methods
│   │   │       ├── README.md
│   │   │       ├── sixa
│   │   │       └── sixb
│   │   ├── mpdf
│   │   │   └── pdf_tmp
│   │   │       └── README
│   │   ├── onsite_portal_documents
│   │   │   └── templates
│   │   │       ├── Help.tpl
│   │   │       ├── Hipaa_Document_Oemr.tpl
│   │   │       ├── Insurance_Info.tpl
│   │   │       ├── Medical_History.tpl
│   │   │       └── Privacy_Document.tpl
│   │   ├── procedure_results
│   │   │   └── README
│   │   ├── smarty
│   │   │   ├── gacl
│   │   │   │   └── README
│   │   │   └── main
│   │   │       ├── %%12
│   │   │       │   └── 12F
│   │   │       │       └── 12FD7729%%lang.eng.php
│   │   │       ├── %%1E
│   │   │       │   └── 1EA
│   │   │       │       └── 1EA5C8E9%%ajax_template.html.php
│   │   │       ├── %%5B
│   │   │       │   └── 5BF
│   │   │       │       └── 5BF5EA9D%%header.html.php
│   │   │       ├── %%61
│   │   │       │   └── 61F
│   │   │       │       └── 61F56BD5%%default.html.php
│   │   │       ├── %%76
│   │   │       │   └── 76B
│   │   │       │       └── 76BE74F5%%default.conf.php
│   │   │       ├── %%A6^A60^A60BDC9D%%general_fragment.html.php
│   │   │       └── README
│   │   └── temp
│   │       └── README
│   ├── faxcover.txt
│   ├── faxtitle.eps
│   ├── images
│   │   ├── login_logo.gif
│   │   ├── logo_1.png
│   │   ├── logo_2.png
│   │   └── visa_mc_disc_credit_card_logos_176x35.gif
│   ├── referral_template.html
│   ├── sqlconf.php
│   └── statement.inc.php
└── test
    ├── LBF
    │   ├── LBFathbf.plugin.php
    │   ├── LBFathv.plugin.php
    │   ├── LBFfms.plugin.php
    │   ├── LBFgcac.plugin.php
    │   ├── LBFvbf.plugin.php
    │   └── LBTref.plugin.php
    ├── clickoptions.txt
    ├── config.php
    ├── docker-version
    ├── documents
    │   ├── certificates
    │   │   └── README.md
    │   ├── couchdb
    │   │   └── README
    │   ├── custom_menus
    │   │   ├── Custom.json
    │   │   └── patient_menus
    │   │       └── Custom.json
    │   ├── edi
    │   │   └── README.txt
    │   ├── era
    │   │   └── README.txt
    │   ├── letter_templates
    │   │   └── sample
    │   ├── logs_and_misc
    │   │   └── methods
    │   ├── mpdf
    │   │   └── pdf_tmp
    │   │       └── README
    │   ├── onsite_portal_documents
    │   │   └── templates
    │   │       ├── Help.tpl
    │   │       ├── Hipaa_Document_Oemr.tpl
    │   │       ├── Insurance_Info.tpl
    │   │       ├── Medical_History.tpl
    │   │       └── Privacy_Document.tpl
    │   ├── procedure_results
    │   │   └── README
    │   ├── smarty
    │   │   ├── gacl
    │   │   │   └── README
    │   │   └── main
    │   │       ├── %%12
    │   │       │   └── 12F
    │   │       │       └── 12FD7729%%lang.eng.php
    │   │       ├── %%1E
    │   │       │   └── 1EA
    │   │       │       └── 1EA5C8E9%%ajax_template.html.php
    │   │       ├── %%5B
    │   │       │   └── 5BF
    │   │       │       └── 5BF5EA9D%%header.html.php
    │   │       ├── %%61
    │   │       │   └── 61F
    │   │       │       └── 61F56BD5%%default.html.php
    │   │       ├── %%76
    │   │       │   └── 76B
    │   │       │       └── 76BE74F5%%default.conf.php
    │   │       ├── %%A6^A60^A60BDC9D%%general_fragment.html.php
    │   │       └── README
    │   └── temp
    │       └── README
    ├── faxcover.txt
    ├── faxtitle.eps
    ├── images
    │   ├── login_logo.gif
    │   ├── logo_1.png
    │   ├── logo_2.png
    │   └── visa_mc_disc_credit_card_logos_176x35.gif
    ├── referral_template.html
    ├── sqlconf.php
    └── statement.inc.php

64 directories, 85 files
1 Like

Ok, I’ll try to re-create the second site again tomorrow. In terms of the issue with my default site appearing to not be setup, any recommendations? Should I go through the setup process even though it technically has already been setup?

1 Like

I am sorry, I was not specific enough. You also need to modify the following in openemr/sites/default/sqlconf.php from 0 to 1. It should read like this:

//////////////////////////
//////////////////////////
//////////////////////////
//////DO NOT TOUCH THIS///
$config = 1; /////////////
//////////////////////////
//////////////////////////
//////////////////////////

That tells openemr that the site has already been configured.
I am sorry I left that out.

1 Like

In terms of the second site, had you already created one before your re-install?

Ahh ok that solved my issue with the default site. Thanks.

And no, I had not already created a second site before the reinstall.

1 Like

Tried to create a second site again, but the same issue arose. New database was created, new site shows up on localhost/openemr/admin.php, but unable to log in (same error as before is showing), and same files are missing from the new site directory.

1 Like

try again please but don’t create the multi site directory beforehand

this probably needs to be removed from the instructions:

Create a directory in openemr/sites, you can use any preferred name for your new sites directory e.g your_other_clinic_name

Give the newly created directory writable permission for the webserver so that it can create additional directories as needed

the php script should be able to handle this for you

2 Likes

You were able to complete setup for the new site without errors?

You can compare the setup dialogs here:

https://www.open-emr.org/wiki/index.php/OpenEMR_6.0.0_Windows_Installation

New site setup went flawlessly! I’m going to consolidate all the info that helped me so that I can mark this as the solution…

From @gutiersa
Reinstalling OpenEMR is not hard. Just rename the current directory to “openemr_old” or something like that so as not to lose your “sites” directory and reinstall after doing checksum. If your initial download is corrupt, other problems will occur later on.

You may run setup again to after reinstalling openemr, but then you will have to drop your databases (I don’t recommend this), or use different database names. This is a problem if you already have data in your databases. Another option is to do the following:

If you have more than one site, then copy and paste openemr/sites/default as many times as your need. You will wind up with something like this:

openemr/sites/defaut
openemr/sites/defaut copy
openemr/sites/defaut copy(1)
openemr/sites/defaut copy(2)

Rename the directories as needed:

openemr/sites/defaut
openemr/sites/site1
openemr/sites/site2
openemr/sites/site3

The reason I do it this way is in case changes have been made with previous patches. In your case, you can probably just copy the whole sites directory from your old installation (I don’t recommend it because of the corruption issue). But in my case, my installation is old and I have been updating it and patching it over time. Also, in your case, if you have a corrupt installation, you may have corrupt or missing files in the original default directory.

Do the following for each of your sites. Again, notepad++ is safe for editing files.

Edit sqlconf.php in openemr/sites/default with notepad++ to make it work with your default database

and 

Copy openemr/sites/default/documents/logs_and_misc/methods/sixa and sixb to the same location in your new install.

You also need to modify the following in openemr/sites/default/sqlconf.php from 0 to 1. It should read like this:

//////////////////////////
//////////////////////////
//////////////////////////
//////DO NOT TOUCH THIS///
$config = 1; /////////////
//////////////////////////
//////////////////////////
//////////////////////////

That tells openemr that the site has already been configured.

finally, copy all your directories that begin with a number in:

openemr_old/sites/default/documents
openemr_old/sites/site1/documents
openemr_old/sites/site2/documents
openemr_old/sites/site3/documents

to your new openemr install.

Then try again to use the multisite and cloning feature in setup.php. But remember to save setup.php prior to applying patches, because patching it deletes the text in it!

From @stephenwaite
Don’t create the multi site directory beforehand, the php script should be able to handle this for you.

Thanks everyone for the help! :grinning:

1 Like