Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AllenShaw/installation
  • documentation/docs/installation
  • DaveD/installation
  • seamuslee/installation
  • mattwire/installation
  • KarinG/installation
  • totten/installation
  • codebymikey/installation
  • luke.stewart/installation
  • wmortada/installation
  • ayduns/installation
  • justinfreeman/installation
  • planetwebb/installation
  • ginkgomzd/installation
  • marsh/installation
  • kcristiano/installation
  • yookoala/installation
  • JoeMurray/installation
  • fkohrt/installation
  • branham01/installation
  • iain/installation
  • Chabadrichmond/installation
  • dvhirst/installation
  • ufundo/installation
  • pwndf/installation
  • florian-dieckmann/installation
  • jebba/installation
  • resga/installation
28 results
Show changes
docs/images/wpms/image-20201027191823532.png

70.4 KiB

docs/images/wpms/image-20201027192106159.png

10.3 KiB

docs/images/wpms/image-20201027192425361.png

8.3 KiB

# WordPress Multisite
# WordPress Multisite, CiviCRM Multi-Domain Setup
If using a WordPress multisite when CiviCRM is activated the `civicrm.settings.php` file is added within the [uploads directory for that site](https://wordpress.org/support/article/multisite-network-administration/#uploaded-file-path). Site 1, generally the main site of the multisite, uses the default upload path `/wp-content/uploads/civicrm`.
These instructions are for setting up a network from scratch. If you already have an existing WordPress Multisite, then some of the procedures will need to be skipped and some will need to be amended for your situation. This is the recommended procedure, however, since getting the basics right means that whatever is built on top of that is based on solid foundations.
If you are looking to share one CiviCRM database across multiple websites, for a chapter like setup, the following needs to be added to your `wp-config.php` file.
## Install WordPress Single Site as normal
``` php
// define CiviCRM constants here
if ( ! defined( 'CIVICRM_SETTINGS_PATH' ) ) {
define( 'CIVICRM_SETTINGS_PATH', '/path/to/wordpress/website/wp-content/uploads/civicrm/civicrm.settings.php' );
}
Add the following plugins but do not activate them:
- [_CiviCRM_](https://civicrm.org/download)
- [_CiviCRM Admin Utilities_](https://wordpress.org/plugins/civicrm-admin-utilities/)
- [_CiviCRM Permissions Sync_](https://develop.tadpole.cc/plugins/civicrm-permissions-sync)
## Enable WordPress Multisite
Add the following to `wp-config.php`
```php
/**
* Allow multisite.
*
* This can be commented out once Multisite has been set up - the only thing it
* does is enable the "Network Setup" menu item.
*/
define( 'WP_ALLOW_MULTISITE', true );
```
This will define the path for all websites on the multisite and when enabled they will access the CiviCRM instance defined by the path settings and access is managed through the `civicrm.settings.php` as this example outlines.
Run WordPress Multisite "Network Setup" under Tools
## WordPress Multisite using Subdomains
If you have your multisite set up as subdomains, follow these steps.
![image-20201027174136563](../images/wpms/image-20201027174136563.png)
!!! note "Change your `civicrm.settings.php` file"
Keep in mind, you should **only** change the `civicrm.settings.php` file that lives in `wp-content/uploads/civicrm` (the parent/main site's uploads folder).
- Choose subdomain or sub-directory. Both work the same way.
- Example is subdomain as that takes slightly more setup.
- Update `wp-config.php` add the following lines:
Find the block of code that resembles this:
```php
if (!defined('CIVICRM_UF_BASEURL')) {
define( 'CIVICRM_UF_BASEURL' , 'http://example.org/');
/**
* WordPress Multisite setup.
*/
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'wpcvms.test');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
```
- Update `.htaccess` and replace all existing WordPress rules with:
```bash
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
```
- Log back in and now we have a network
## _CiviCRM_ Setup
### Site 1
Activate the following plugins:
- _CiviCRM Permissions Sync_
- Check that the `CIVICRM_PERMISSIONS_SYNC_MODE` constant is set to your liking. The choices can be found [in the plugin's code](https://develop.tadpole.cc/plugins/civicrm-permissions-sync/-/blob/master/civicrm-permissions-sync.php#L19-38). For this kind of install, the default of `groups` is fine.
- Network Activate
- _CiviCRM_
- Activate _only_ on Site 1
- Run Installer
- Using a separate database for CiviCRM is probably a wise choice.
- _CiviCRM Admin Utilities_
- Network Activate
Go To _CiviCRM_
- Create a Group for Site 1
- This will be the Domain Group for Domain 1
- Add the [Multisite Extension](https://lab.civicrm.org/extensions/multisite)
- On Site 1 Go to _CiviCRM Admin Utilities_ Settings, then Domain tab
- You should see:
![image-20201027175354535](../images/wpms/image-20201027175354535.png)
- Follow the link and set up Site 1 "Multisite" (in the CiviCRM sense)
- Go back to _CiviCRM Admin Utilities_
- The "Domain" tab should look like:
![image-20201027175658226](../images/wpms/image-20201027175658226.png)
- Go to WordPress Network Admin, then _CiviCRM Admin Utilities_ Settings
- The "Domain" tab should look like:
![image-20201027175824708](../images/wpms/image-20201027175824708.png)
### Site 2
- Create a new WordPress Sub-site (Site 2)
![image-20201027175950175](../images/wpms/image-20201027175950175.png)
- Edit the new site
- Look at the URL
- It MUST match what you will be setting _CiviCRM_ to. Make sure the URL begins with `https` not `http` - edit if necessary
![image-20201027180035261](../images/wpms/image-20201027180035261.png)
![image-20201027180145841](../images/wpms/image-20201027180145841.png)
- Update `wp-config.php` to use a single `civicrm.settings.php` file
- Add the following:
```php
/**
* Force CiviCRM to use a single settings file.
*/
if ( ! defined( 'CIVICRM_SETTINGS_PATH' ) ) {
define( 'CIVICRM_SETTINGS_PATH', '/srv/www/wpcvms/wp-content/uploads/civicrm/civicrm.settings.php' );
}
```
**Remove it entirely**, and replace it with the following code:
- Add `civicrm.domains.php` to same directory as `civicrm.settings.php`
```php
<?php
/**
* CiviCRM Multisite Domain functionality.
*
* @see https://gist.github.com/christianwach/5ca120670152df3dbfb8d3ca42079a96
*/
/**
* Define CiviCRM Multisite Domain constants and settings.
*
* When a WordPress site is accessed, CiviCRM needs to know a number of settings
* that enable Multisite Domain functionality. Define that data here.
*
* Once the Domain has been created (e.g. via the form on the "Domains" tab of
* the CiviCRM Admin Utilities network settings page) add the corresponding data
* array for the Domain to the array below. The four uncommented entries are
* required. Do this *before* enabling CiviCRM on the WordPress sub-site.
*
* The good thing about separating this functionality out in this way is that we
* can now read the correspondences between WordPress sites and CiviCRM Domains.
* The main array is keyed by the `home_url()` of the relevant WordPress site.
*
* If you want easy access to the `domain_group_id` and/or the `domain_org_id` for
* a WordPress site, then these can be filled out and uncommented, though they are
* not strictly necessary for multiple CiviCRM Domains to work and can be discovered
* by other means.
*
* @return array $data The CiviCRM Multisite Domain data.
*/
function civicrm_multisite_get_domain_data() {
// Define CiviCRM Multisite Domain data.
$data = array(
'https://example.org' => array(
'domain_id' => 1,
'domain_group_id' => 7,
'domain_org_id' => 1,
//'wp.frontend.base.url' => 'https://example.org/',
//'wp.backend.base.url' => 'https://example.org/wp-admin/',
'extensionsDir' => '<path to extensions folder>',
'extensionsURL' => '<URL to extensions directory>',
'userFrameworkResourceURL' => 'https://example.org/wp-content/plugins/civicrm/civicrm/',
),
'https://sub.example.org' => array(
'domain_id' => 21,
'domain_group_id' => 13,
'domain_org_id' => 35603,
//'wp.frontend.base.url' => 'https://sub.example.org/',
//'wp.backend.base.url' => 'https://sub.example.org/wp-admin/',
'extensionsDir' => '<path to extensions folder>',
'extensionsURL' => '<URL to extensions directory>',
'userFrameworkResourceURL' => 'https://example.org/wp-content/plugins/civicrm/civicrm/',
),
'https://sub0.example.org' => array(
'domain_id' => 20,
'domain_group_id' => 23,
'domain_org_id' => 35604,
//'wp.frontend.base.url' => 'https://sub0.example.org/',
//'wp.backend.base.url' => 'https://sub0.example.org/wp-admin/',
'extensionsDir' => '<path to extensions folder>',
'extensionsURL' => '<URL to extensions directory>',
'userFrameworkResourceURL' => 'https://example.org/wp-content/plugins/civicrm/civicrm/',
),
)
// Define CiviCRM Multisite Domain data.
$data = array(
// Always put the data for the main site first.
'https://wpcvms.test' => array(
'domain_id' => 1,
//'domain_group_id' => 5,
//'domain_org_id' => 1,
'extensionsDir' => '/srv/www/wpcvms/wp-content/uploads/civicrm/ext/',
'extensionsURL' => 'https://wpcvms.test/wp-content/uploads/civicrm/ext/',
'userFrameworkResourceURL' => 'https://wpcvms.test/wp-content/plugins/civicrm/civicrm/',
),
// Add sub-sites after the main site.
'https://ny.wpcvms.test' => array(
'domain_id' => 2,
//'domain_group_id' => 6,
//'domain_org_id' => 203,
'extensionsDir' => '/srv/www/wpcvms/wp-content/uploads/civicrm/ext/',
'extensionsURL' => 'https://ny.wpcvms.test/wp-content/uploads/civicrm/ext/',
'userFrameworkResourceURL' => 'https://ny.wpcvms.test/wp-content/plugins/civicrm/civicrm/',
),
);
// --<
return $data;
}
/**
* Get the URL for the requested WordPress site.
*
* @return str $url The URL for the requested WordPress site.
*/
function civicrm_multisite_get_url_from_server_vars() {
// We first need to find the URL of the current site.
if ( function_exists( 'home_url' ) ) {
// When WordPress is bootstrapped, this is always correct.
$url = home_url();
} else {
/*
* The following code deals with WordPress multisite when it is configured
* for sub-directories.
*
* If your multisite uses subdomains and you are not routing all calls to
* CiviCRM via WordPress (e.g. by using WP-REST instead of `extern/*.php`
* or `bin/*.php`) then you'll have to amend this.
*
* Q: How do we discover sub-directory paths from $_SERVER alone?
* A: There isn't a reliable way unless all sites are known.
*
* The true solution to this guesswork is never to bootstrap CiviCRM except
* via WordPress. I'm looking at you `extern/*.php`.
*
* tl;dr Always route via WordPress.
*/
// Protocol is easy:
$protocol = strstr( 'HTTPS', $_SERVER['SERVER_PROTOCOL'] ) ? 'https://' : 'http://';
// Get "site path" - the first part of the path.
$path = '';
if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
$tmp_path = explode( '/', $_SERVER['REQUEST_URI'] );
$path = isset( $tmp_path[0] ) ? '/' . $tmp_path[0] : '';
}
// Put it all together.
$url = $protocol . $_SERVER['SERVER_NAME'] . $path;
}
// --<
return $url;
}
/**
* Set CiviCRM Multisite Domain constants and settings.
*
* When a WordPress site is accessed, CiviCRM needs to know what Domain is being
* accessed. This is far from trivial :(
*/
function civicrm_multisite_set_domain_data_for_site() {
// We need access to some CiviCRM globals.
global $civicrm_setting, $civicrm_paths;
// Get the URL for the requested site.
$url = civicrm_multisite_get_url_from_server_vars();
// Get CiviCRM data.
$data = civicrm_multisite_get_domain_data();
// Use Main Site if we don't have an entry.
if ( empty( $data[$url] ) ) {
$settings = array_shift( $data );
} else {
$settings = $data[$url];
}
// Always set the Base URL.
define( 'CIVICRM_UF_BASEURL', $url );
// Set the CiviCRM Domain ID.
if ( isset( $settings['domain_id'] ) ) {
define( 'CIVICRM_DOMAIN_ID', $settings['domain_id'] );
}
// CiviCRM does not need these two constants, but you may wish to set them for reference.
if ( isset( $settings['domain_group_id'] ) ) {
define( 'CIVICRM_DOMAIN_GROUP_ID', $settings['domain_group_id'] );
}
if ( isset( $settings['domain_org_id'] ) ) {
define( 'CIVICRM_DOMAIN_ORG_ID', $settings['domain_org_id'] );
}
// These paths are crucial for CiviCRM.
if ( isset( $settings['extensionsDir'] ) ) {
$civicrm_setting['domain']['extensionsDir'] = $settings['extensionsDir'];
}
if ( isset( $settings['extensionsURL'] ) ) {
$civicrm_setting['domain']['extensionsURL'] = $settings['extensionsURL'];
}
if ( isset( $settings['userFrameworkResourceURL'] ) ) {
$civicrm_setting['domain']['userFrameworkResourceURL'] = $settings['userFrameworkResourceURL'];
}
}
```
Rinse and repeat for any additional subdomains.
// Trigger Multisite discovery immediately.
civicrm_multisite_set_domain_data_for_site();
```
Big thanks to **Christian Wach** for [this code](https://gist.github.com/christianwach/5ca120670152df3dbfb8d3ca42079a96), which was adapted to fit subdomain setup.
- Now go back and edit `civicrm.settings.php`:
* Around line 80 or so, comment out the paths and URL settings:
You do **not** need to do the **Create the domain record** step (stated above) if you use the [multisite extension](https://lab.civicrm.org/extensions/multisite). It is recommended you copy and paste the following command into your shell/terminal:
```php
// Additional settings generated by installer:
/*
$civicrm_paths['wp.frontend.base']['url'] = 'https://wpms.test/';
$civicrm_paths['wp.backend.base']['url'] = 'https://wpms.test/wp-admin/';
$civicrm_setting['domain']['userFrameworkResourceURL'] = 'https://wpms.test/wp-content/plugins/civicrm/civicrm';
*/
`wp cv api MultisiteDomain.create debug=1 sequential=1 name="Sub1ExampleOrg" is_transactional=0 group_id="2" contact_id="4"`
```
!!! note "Important Note"
- Further down the `civicrm.settings.php` file:
* Around line 235 or so, comment out the code that defines `CIVICRM_UF_BASEURL`
* Include/require the `civicrm.domains.php` file
* (The settings could be included here, but it's cleaner to have a separate file)
* `Sub1ExampleOrg`: This should be replaced with a name for the domain.
* `group_id`: This can be found as the `group_id` column in the table called `civicrm_group_organization`.
* `contact_id`: This can be found as the `organization_id` column in the table called `civicrm_group_organization`.
```php
/*
if (!defined('CIVICRM_UF_BASEURL')) {
define( 'CIVICRM_UF_BASEURL' , 'https://wpms.test');
}
*/
**You will need to do this for each subdomain, so keyboard shortcuts are strongly encouraged.**
// Include the Domain settings file.
require_once 'civicrm.domains.php';
```
After you've done this, if you don't have it already, download and install the [CiviCRM Admin Utilities plugin for WordPress](https://wordpress.org/plugins/civicrm-admin-utilities/). **Make sure it (and CiviCRM itself) is Network Activated!** You will need it in a second.
- Now back to WordPress Network Admin, _CiviCRM Admin Utilities_, "Domain" tab
Visit one of your sites via it's subdomain in your browser.
![image-20201027180252729](../images/wpms/image-20201027180252729.png)
Along your left menu, find **Settings**, and hover over it. Click **CiviCRM Admin Utilities** when the menu pops out.
- Create a new _CiviCRM_ Domain
Scroll to the bottom, find where it says **Miscellaneous Utilities**.
![image-20201027180332753](../images/wpms/image-20201027180332753.png)
1. Check the box next to **Clear Caches**.
2. Once it refreshes the page, return to the CiviCRM Admin Utilities page. Click the link that says **Click this to rebuild the CiviCRM menu.**
3. Again, once it refreshes, return to the CiviCRM Admin Utilities page. Click the last link that says **Click this to rebuild the triggers in the CiviCRM database.**
- Activate _CiviCRM_ on Site 2
- Go To Site 2 Settings menu --> _CiviCRM Admin Utilities_ --> "Domain" tab
Once you have that, you should be good to go!
![image-20201027183932098](../images/wpms/image-20201027183932098.png)
**However...**
- Repeat for other Domains
If you still experience errors or problems at this point, make sure to clear your browser cache. If to no avail, try private/incognito browsing. Finally, as a last point, clear your DNS cache.
## Permissions
* Windows (Terminal/CMD): `ipconfig /flushdns`
* Mac/Linux: `sudo killall -HUP mDNSResponder`
- You will need to set permissions to limit access. Administrators and Network Admins will have pre-defined rights.
**Recommendation**: Create a Site Admin role for any administrator of sub-sites that are sharing CiviCRM, meaning the default Administrator role is only used on the main site. This is recommended since by default all Adminstrators automatically get access to Administer CiviCRM and will be able to create things like custom data fields. By creating a Site Admin role the CiviCRM permissions can be managed from [Administer > Users and Permissions > Permissions (Access Control)](https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control/#access-control-permissions-in-wordpress) and will allow only main site administrator access to Administer CiviCRM.
![image-20201027192106159](../images/wpms/image-20201027192106159.png)
......@@ -4,7 +4,8 @@ CiviCRM works with several popular open source Content Management Systems (CMS).
* Backdrop CMS
* Drupal 7
* Drupal 8
* Drupal 9 (Reached [end of life status](https://www.drupal.org/docs/understanding-drupal/drupal-9-release-date-and-what-it-means/how-long-will-drupal-9-be-supported))
* Drupal 10
* Joomla
* WordPress
......@@ -29,8 +30,8 @@ Support for running CiviCRM with WordPress was added in 2012, which allowed Word
Broadly there are some differences which arise because of distinctive features/norms in each CMS community, e.g.
* In WordPress, it's pretty common to embed content in your web-pages using short-codes. CiviCRM has several short-codes in WP.
* In Backdrop CMS/Drupal 7/Drupal 8, it's pretty common to embed content in your web-pages using blocks. CiviCRM has several blocks in Drupal.
* In Backdrop CMS/Drupal 7/Drupal 8, CiviCRM makes use of the CMS's "roles" and "permissions" using the CMS's interfaces and approaches, and there are modules to synchronize CiviCRM groups and membership types to them.
* In Backdrop CMS/Drupal 7/Drupal 9/Drupal 10, it's pretty common to embed content in your web-pages using blocks. CiviCRM has several blocks in Drupal.
* In Backdrop CMS/Drupal 7/Drupal 9/Drupal 10, CiviCRM makes use of the CMS's "roles" and "permissions" using the CMS's interfaces and approaches, and there are modules to synchronize CiviCRM groups and membership types to them.
* In Joomla/WordPress, "roles" and "permissions" can also be managed using the CMS's interfaces and approaches, and there are plugins to synchronize groups and membership types to them.
## Installation Process
......@@ -43,7 +44,7 @@ The core system is the same across all CMS options, but occasionally there are b
The size of the install base shown [on the CiviCRM Stats site](https://stats.civicrm.org/?tab=sites) also affects how well reported issues are and how quickly fixes are tested and merged. While trends are subject to change, as of 2019, Joomla shows the least growth and WordPress the most.
Therefore it may take a bit longer to identify/resolve bugs in the BackDrop, Drupal8, Joomla and WordPress integrations but automated testing on these platforms is being continually improved.
Therefore it may take a bit longer to identify/resolve bugs in the BackDrop, Drupal, Joomla and WordPress integrations but automated testing on these platforms is being continually improved.
The following chapters in this section go into more detail about what is offered for each CMS.
......@@ -58,7 +59,7 @@ You may also choose a CMS because you already know how to use it or it is alread
**Drupal** is the most flexible and has the best integration with CiviCRM. If you have complex CMS needs or envisage a lot of interaction between users on your website and your CRM, then Drupal might be the CMS for you. The main negative is that this flexibility makes it harder for new site builders to get to grips with.
**Backdrop CMS** is very similar to Drupal 7, with many improvements making it slick and lightweight. It started as a fork (that is, a copy) of Drupal 7, aimed at users for whom Drupal 8 was likely to be too complex either to use, or to migrate to from Drupal 7. Drupal 7 modules and themes require modifications to work with Backdrop CMS, though many have already been ported and are actively maintained.
**Backdrop CMS** is very similar to Drupal 7, with many improvements making it slick and lightweight. It started as a fork (that is, a copy) of Drupal 7, aimed at users for whom Drupal 9 or Drupal 10 was likely to be too complex either to use, or to migrate to from Drupal 7. Drupal 7 modules and themes require modifications to work with Backdrop CMS, though many have already been ported and are actively maintained.
**Joomla** isn't as popular as WordPress, though it is more popular than Drupal. Joomla is easier to learn than Drupal. The amount of integration available is lower than then when using Drupal.
......
!!! tip "New release"
Standalone is a new way to use CiviCRM. You can help continue to improve it by reporting any issues you experience [on the issue tracker](https://lab.civicrm.org/dev/core/-/issues/?label_name%5B%5D=comp%3AStandalone).
???+ tldr "About this document"
This guide covers installation of CiviCRM Standalone (without a parent CMS). It assumes that you previously
[reviewed the CiviCRM requirements](../general/requirements.md).
## Step 1. Choose an install method
There are currently five options for installing CiviCRM Standalone. If in doubt, Option 1 is the recommended method for most sites.
??? example "Option 1. Download a release tarball - most sites"
This is the recommended install method for most regular sites. The rest of this page assumes you are installing this way.
??? example "Option 2. Use composer - complex sites"
Using composer allows more automated management of site installation and packages. It may be useful in some contexts, such as automated deployments. It requires shell access and is *not* recommended if you are new to CiviCRM.
??? example "Option 3. Using CiviCRM Buildkit - for developers"
If you are a developer contributing to CiviCRM Core, then it is recommend to use [CiviCRM Buildkit](https://docs.civicrm.org/dev/en/latest/tools/buildkit/) to create Standalone sites. The primary site template is called `standalone-clean`. A composer-style alternative is called `standalone-composer`.
Using Buildkit is only recommended for test sites. If you are hoping to run CiviCRM Standalone in production in future, you should follow Option 1 or 2.
??? example "Option 4. Download with git - not recommended"
You can also install CiviCRM Standalone by cloning the git repo directly. This is generally not recommended - if you need git it is probably easier to use Buildkit.
??? example "Option 5. Using Docker"
If you have used Docker before, this can be a quick way to get up and running. You can find install instructions [on the project repo](https://github.com/civicrm/civicrm-docker)
The rest of this page assumes you are installing from a release tarball (Option 1).
## Step 2. Get the code {:#download}
The latest release is available from [the main release page](https://civicrm.org/download). Select "Download CiviCRM 5.x.x" from the download options.
[Download this month's release](https://download.civicrm.org/latest/civicrm-STABLE-standalone.tar.gz)
The release contains all the code for your site in a compressed tarball file (`.tar.gz`).
??? error "Pre-release versions"
Pre-release versions are available to download from [the latest releases page](https://download.civicrm.org/latest/).
Choose the option that ends `*-RC-standalone` for the latest Release Candidate (RC) for next month's release. Testing the RC will help improve the stability of the next month's release.
Choose the option that ends `*-NIGHTLY-standalone` for the latest Nightly Build. This is the very latest version available, but be warned, there may be bugs! 🐛
## Step 3. Deploy the code to your web server/hosting {:#download}
At this step you need to extract the code and transfer it your web server.
If you are using web hosting, you may be able to upload the compressed file and then extract it, or extract it on your computer and then upload the extracted files. It depends a bit on your hosting configuration.
The key thing is to maintain the folder structure from the release archive. Your main folder should contain at least a `civicrm.standalone.php` file, as well as `core`, `public` and `private` subfolders.
You need to make sure this folder is located somewhere your webserver can point to it. Take a note of this folder path (e.g. `/var/www/example.org` or `/mywebhost/user123124019231/sites/civicrm`) as you will need it later.
Note: you should point a domain or subdomain directly at the Standalone project root. Installing to a URL subdirectory (e.g. https://mysite.com/projects/standalone) is not currently supported.
??? info "More detail: CiviCRM Standalone folder structure"
Standalone sites should have a main folder which in Standalone is known as the _"project root"_.
After the system has been fully installed and used, you can expect the contents of that folder to look like this:
| File/Folder | Contents |
| -- | -- |
| `civicrm.standalone.php` | Standalone boot file. This identifies the Standalone Project Root, and identifies the locations of the CiviCRM code and settings files. |
| `core/` | Core source code for CiviCRM |
| `private/` | Private site files which should not be accessible over the web |
| `private/civicrm.settings.php` | Configuration file with low level settings for CiviCRM. |
| `private/log/` | Log files |
| `private/cache/` | Cache files for CiviCRM's template compiler |
| `private/l10n/` | Translation files |
| `private/attachment/` | Private files uploaded to your CiviCRM site - such as files uploaded to a specific contact |
| `public/` | Public site files which *should* be accessible over the web |
| `public/media/` | Public files uploaded to your site, like images that appear on a contribution page or in a mass email |
| `public/ang/` | Angular templates - e.g. for custom forms added to your site with FormBuilder |
| `ext/` | CiviCRM extensions you have added to your site |
<!-- FIXME: Describe more items from `web/upload/` -->
## Step 4. Get translations if needed {:#i18n}
The default CiviCRM language is US English (`en_US`). You can select a different language or locale during the web installation step, and the chosen translations will be downloaded for you. You don't need to do anything now.
Alternatively, if you need the web installer in another language you can manually download all the translation files now.
Head to https://civicrm.org/download and choose "Internationalisation files" from the Download dropdown, then copy the `l10n` directory from the download into the `private` directory of your site (so you should end up with folders like `private/l10n/es_ES`).
## Step 5. Configure MySQL {:#mysql}
CiviCRM stores data in MySQL (or, equivalently, MariaDB). You will need to provide a new database and determine key details:
* MySQL hostname/IP (*and, optionally, port number*)
* MySQL database name
* MySQL username
* MySQL password
??? example "_MySQL_: Set up a new database on your webhosting"
If you are using a webhost, they will often provide a UI for this, from which you can get these details.
Alternatively, they may provide _phpmyadmin_ or _cpanel_ access to your database server. You can find guides for these tools online, e.g. https://phppot.com/mysql/phpmyadmin-create-database/ or https://support.cpanel.net/hc/en-us/articles/360057550753-How-to-create-a-database-and-database-user-in-cPanel
<!-- Might be good to have more specific pointers for phpmyadmin or cpanel? -->
??? example "_MySQL_: Create database via command-line"
Open the `mysql` command-line interface. You may need to run one of these commands:
```bash
mysql
mysql -u root
mysql -u root -p
mysql -u root -p --host=db.example.com --port=3306
```
This should display a welcome message:
```
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6879
Server version: 8.0.29 Source distribution
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
```
Now, you can configure a database (`civicrm`), user (`civicrm`), and password (`__TOP_SECRET__`):
```sql
mysql> CREATE DATABASE civicrm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'civicrm'@'localhost' IDENTIFIED BY '__TOP_SECRET__';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT ALL on civicrm.* to 'civicrm'@'localhost';
Query OK, 0 rows affected (0.01 sec)
```
## Step 6. Configure your webserver {:#webserver}
Now you need to configure your webserver to point to your CiviCRM Standalone project folder.
The exact steps vary based on your specific environment. Here are some typical tasks for common environments:
??? example "_Web hosting_: Point a new subdomain to your Standalone project folder"
If you are using web hosting and your release code is in e.g. `/mywebhost/user123/my-sites/civicrm`, then you should just need to point a domain or subdomain from your hosting to this directory.
You will need to make sure PHP is enabled, including the php modules detailed in the Installation Requirements. Your web host may provide a UI, or you may need to add a `php.ini` file specifying options.
You should specify that the `private` folder should *not* be web accessible.
??? example "_Apache_: Configure a virtual-host on Debian-based server"
If you created a folder like `/var/www/example.com/web`, then you probably need to configure the web-server to read this folder.
The essence is to create a configuration file underneath `/etc/apache2/sites-*` with a `<VirtualHost>` declaration, such as:
```
<VirtualHost *:80>
ServerAdmin me@example.com
DocumentRoot /var/www/example.com/web
ServerName example.com
...
</VirtualHost>
```
For a complete example, see [Installing virtual hosts for Drupal sites](https://www.drupal.org/node/111238). (This example is for Drupal,
but similar steps should work for CiviCRM Standalone - simply adjust the `DocumentRoot` and `ServerName`.)
??? example "_nginx_: Configure a virtual-host on Debian-based server"
An example starting point for nginx virtual host configuration is available in the [CiviCRM Standalone repository](https://github.com/civicrm/civicrm-standalone).
## Step 7. Configure webserver permissions {:#webserver}
Your webserver will need to be able to write to at least your `public` and `private` directories. If you wish to install extensions through the web UI on your site, the webserver will also need to write to the `ext` directory.
On many webhosts the webserver will be able to write to all directories, and you won't need to do anything.
If you have `ssh` access to your server, you may need to set the user permissions directly.
??? example "_Permissions_: Grant write access to `public`, `private` and `ext` directories on Linux server"
In most Linux distributions, the web server runs with a special user+group (such as `www-data` or `www`).
You must specifically grant access for this user to write to data folders. Typically you will want to grant access for the group `www-data` to `private`, `public` and `ext` folders.
```bash
cd /var/www/example.com/web
chmod 2770 private public ext
chmod g+rwX -R private public ext
chgrp -R www-data private public ext
```
<!-- Should we recommend `setfacl` (Linux) and `chmod +a` (MacOS)? Or is this assuming that current-user is also in `www-data`? -->
<!-- These are the configs I've liked: https://github.com/amp-cli/amp/blob/0.7.3/app/defaults/services.yml#L189-L199 -->
## Step 8. Run the installer {:#installer}
The installer verifies requirements, prepares the database, and initializes the configuration file. You may run the installer through the web interface (*which is simpler*) or the command-line interface (*which has more options*).
??? example "Run installer via web UI"
1. Head to the `/civicrm` page on your website. This may look like:
* `https://example.com/civicrm`
* `http://localhost:8000/civicrm`
* `http://example.127.0.0.1.nip.io:8001/civicrm`
2. The CiviCRM installer will open.
* You will need to provide the details for the database you created earlier
* You also have to provide a username, password and e-mail address for the site adminstrator user. Note: this login is totally separate from the database username and password in step 1.
* *If there are unmet requirements*, the installer will list them. Consult the [Requirements](../general/requirements.md) documentation for additional advice.
* *If all the requirements are met*, proceed through the questionnaire.
* You can select another language if you want CiviCRM to be installed in another language then English US. The installer will then download the translation files for you.
* Finally, click "Install CiviCRM".
3. After installing, you should see a confirmation page confirming installation has completed correctly.
??? example "Run installer via command-line"
CiviCRM has a command-line administration tool, `cv`, which can perform installation. For a local dev site, a typical install command might be:
```bash
cd /path/to/standalone-service-root
cv core:install -v \
--cms-base-url=http://localhost:8000 \
--db=mysql://USER:PASS@HOST:PORT/DATABASE \
-m extras.adminUser=USERNAME \
-m extras.adminPass=SECRET \
-m extras.adminEmail=ME@EXAMPLE.COM
```
For full details, see [command-line installer](../general/cli-cv.md).
The installer will verify that you've downloaded the correct version of CiviCRM, and will check your server environment to make sure it meets CiviCRM requirements. It will then create and populate a database for CiviCRM as well as create your CiviCRM settings file (civicrm.settings.php).
<!-- Do we need to suggest reviewing permissions at the start -- given that we control defaults and given that there's a general checklist? -->
## Log in and review users and permissions {:#users}
You should now be able to log in to your site at e.g. `https://your-site.test/civicrm/login`. Use the administrator username and password you created during install.
Head to **Adminster** >> **Users and Permissions** to configure users and roles for your site.
## Review the checklist {:#checklist}
The **Configuration Checklist** provides a convenient way to work through the settings that need to be reviewed and configured for a new site. You can link to this checklist from the installation success page AND you can visit it at any time from **Administer** » **Administration Console** » **Configuration Checklist**.
## Test-drive CiviCRM {:#test-drive}
Start exploring your new CiviCRM Standalone site. Please report any issues you find in the Issue Tracker: https://lab.civicrm.org/dev/core/-/issues/?label_name%5B%5D=comp%3AStandalone
## Addenda
### Troubleshooting {:#troubleshooting}
* Review the [Troubleshooting](../general/troubleshooting.md) page for help with problems you may encounter during the installation.
......@@ -21,7 +21,6 @@ All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are inclu
* Copy or ftp the zip file to your WordPress installation's `/wp-content/plugins` directory. You may have to change the "File Permissions" setting of `/wp-content/plugins/civicrm` directory to allow for "Write" Access. Just remember to change it back to default when done.
* You can upload the zip file that was downloaded via your WordPress admin panel at `wp-admin/plugin-install.php`
* Create the `<wordpress path>/wp-content/plugins/files/` directory and ensure it is writable. CiviCRM for versions 4.6 and prior uses this directory for temporary and uploaded files.
!!! information "Downloading Directly to Your Server with wget"
If you have command-line access, you may prefer to download the zip file directly to your server using wget:
......@@ -56,7 +55,7 @@ All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are inclu
## Get the translations {:#i18n}
The basic CiviCRM release includes support for US English (`en_US`). To use another language or dialect, please [download and extract the translation files](../general/i18n_l10n.md).
The basic CiviCRM release includes support for US English (`en_US`). To use another language or dialect, please [download and extract the translation files. A guide to help install these can be found [in the System Administration Guide](https://docs.civicrm.org/sysadmin/en/latest/upgrade/wordpress/#install-localization-files-optional).
## Run the installer
......
site_name: CiviCRM Installation Guide
site_url: https://docs.civicrm.org/installation/en/stable/
site_url: https://docs.civicrm.org/installation/en/latest/
repo_url: https://lab.civicrm.org/documentation/docs/installation/
edit_uri: https://lab.civicrm.org/documentation/docs/installation/-/edit/master/docs/
site_description: This guide is aimed at CiviCRM users and implementors who would like to learn how to install and setup CiviCRM.
......@@ -28,10 +28,10 @@ markdown_extensions:
nav:
- Home: index.md
- Install CiviCRM on Backdrop: backdrop/index.md
- Install CiviCRM on Drupal 7: drupal7/index.md
- 'Install CiviCRM on Drupal 8/9': drupal8/index.md
- Install CiviCRM on Drupal: drupal/index.md
- Install CiviCRM on Joomla: joomla/index.md
- Install CiviCRM on WordPress: wordpress/index.md
- "Install CiviCRM (Standalone)": standalone/index.md
- General:
- Requirements: general/requirements.md
- Permissions: general/permissions.md
......
drupal7 drupal