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
Showing
with 1081 additions and 292 deletions
docs/images/wpms/image-20201027183932098.png

39.2 KiB

docs/images/wpms/image-20201027191613282.png

95.8 KiB

docs/images/wpms/image-20201027191715602.png

26.4 KiB

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

## Scope of this guide
This guide is for people installing a [CiviCRM](https://civicrm.org) instance for an organization. It will take you through downloading and installing CiviCRM on one of the supported Content Management Systems. It is not intended to provide information on installing the CMS itself.
### Installation Guide vs other guides
We also have a [User Guide](https://docs.civicrm.org/user/en/latest) which covers all the functionality available through CiviCRM's web-based interface and a [SysAdmin Guide](https://docs.civicrm.org/sysadmin/en/latest) which covers more advanced administration.
The two guides have some overlapping scope when it comes to setup and configuration. In general, we try to cover actions in the User Guide which the user can perform from within CiviCRM's user interface. Actions that require work outside of the CiviCRM interface (e.g. file-system or shell access) are covered in the System Administrator Guide.
## Editing this guide
* This guide is made with MkDocs and stored in a [GitLab repository](https://lab.civicrm.org/documentation/docs/installation).
* See the ["Writing Documentation"](https://docs.civicrm.org/dev/en/latest/documentation)" page in the Developer Guide for specific details on editing this guide.
## Credits
This guide is collaboratively written by the CiviCRM community, with facilitation from the [Documentation Working Group](https://civicrm.org/working-groups/documentation).
## Scope of this guide
This guide is for people installing a [CiviCRM](https://civicrm.org) instance for an organization. It will take you through downloading and installing CiviCRM on one of the supported Content Management Systems. It is not intended to provide information on installing the CMS itself.
### Installation Guide vs other guides
We also have a [User Guide](https://docs.civicrm.org/user/en/latest) which covers all the functionality available through CiviCRM's web-based interface and a [SysAdmin Guide](https://docs.civicrm.org/sysadmin/en/latest) which covers more advanced administration.
The two guides have some overlapping scope when it comes to setup and configuration. In general, we try to cover actions in the User Guide which the user can perform from within CiviCRM's user interface. Actions that require work outside of the CiviCRM interface (e.g. file-system or shell access) are covered in the System Administrator Guide.
## Editing this guide
* This guide is made with MkDocs and stored in a [GitLab repository](https://lab.civicrm.org/documentation/docs/installation).
* See the ["Writing Documentation"](https://docs.civicrm.org/dev/en/latest/documentation)" page in the Developer Guide for specific details on editing this guide.
## Credits
This guide is collaboratively written by the CiviCRM community, with facilitation from the [Documentation Working Group](https://civicrm.org/working-groups/documentation).
## Scope of this guide and alternative installation methods
This guide covers standard installation of CiviCRM for production use. For installing a development environment, refer to the [section on Buildkit in the Developer Documentation](https://docs.civicrm.org/dev/en/latest/tools/buildkit/).
## Before installing
1. Ensure that your system meets the [requirements](../general/requirements.md).
1. Install Joomla by referring to the [Joomla Installation Guide](https://docs.joomla.org/J3.x:Installing_Joomla) if needed.
!!! note "Path for Joomla"
The rest of these instructions assume that you have Joomla installed in `/var/www/JOOMLA_ROOT`. Adjust paths as needed.
## Download and Un-tar CiviCRM Code {:#download}
All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are included in the compressed CiviCRM distribution files ('tarballs'). Follow these steps to download and install the codebase:
* Download the appropriate tarball file from the [CiviCRM website](https://civicrm.org/download) within your browser. Tarball file-names include the CiviCRM version. For example, `civicrm-x.x.x-joomla.zip`. If you have command line access to your server, use `wget` and the URL of the file to pull a copy directly to your server. Then you can skip the next step.
* Upload this file to a folder in your root Joomla directory. Recommended location: `JOOMLA_ROOT/tmp/`.
* Unzip the package, which will create a directory called: `com_civicrm`. On cPanel, you can use the File Manager's Extract function to unzip the file you uploaded.
Note: when installing a new version over an old one, please first check [troubleshooting resources](#troubleshooting) below.
## Run the Installer {:#installer}
* Login to your Joomla Administrator site.
* Go to **Extensions >> Install/Uninstall**.
* Use **Install from Directory** and enter the full path to the un-zipped com_civicrm directory, which should be something like: `JOOMLA_ROOT/tmp/com_civicrm` . In most Joomla installations, the root directory and /tmp/ folder will already populate the "install from directory" field. You must simply add the /com_civicrm/ subfolder at the end. Click Install. If that doesn't work:
* put the full file system path to the `com_civicrm`, something like `/var/www/JOOMLA_ROOT/tmp/com_civicrm/`.
* You should see "Component successfully installed" message.
!!! warning
If you get the following error when installing or upgrading CiviCRM for Joomla - you can downloading the alternate Joomla install file - `civicrm-x.x.x-joomla-alt.zip` - which doesn't require built-in unzip functionality on your server. Then repeat the install steps starting with [running the installer](#installer).
> Your PHP version is missing zip functionality. Please ask your system administrator / hosting provider to recompile PHP with zip support.
Note that missing PHP Zip functionality *will* prevent CiviCRM from installing extensions via the GUI.
## Create CiviCRM Contacts for Existing Joomla Users {:#contacts-users}
Once installed, CiviCRM keeps your Joomla Users synchronized with corresponding CiviCRM contact records. The 'rule' is that there will be a matched contact record for each Joomla user record. Conversely, only contacts who are authenticated users of your site will have corresponding Joomla user records.
When CiviCRM is installed on top of an existing Joomla site, a special CiviCRM Administrative feature allows you to automatically create CiviCRM contacts for all existing Joomla users:
* Login to your Joomla site with an administrator-level login
* Click the **Components > CiviCRM > CiviCRM Home** link in the main navigation block
* Click **Administer > Users and Permissions > Synchronize Users-to-Contacts**
## Troubleshooting Resources {:#troubleshooting}
* If the CiviCRM component does not install correctly (for example you get a blank screen instead of the confirmation page), delete the `~/components/com_civicrm` and `~/administrator/components/com_civicrm` and `~/media/civicrm directories` manually and then try each of the following before attempting to reinstall:
* In your `php.ini` file or in `.htaccess` file in the Joomla root folder (if your server allows it), increase the `max_execution_time` to `600` and memory limit to more than 64M. Add the following to the `.htaccess` file in your Joomla root folder
<!-- markdownlint-disable MD046 -->
``` htaccess
php_value memory_limit 128M
php_value register_globals off
php_value max_execution_time 600
```
If you can't change the `.htaccess` file you can add a php.ini (or `.user.ini`) file in Joomla root folder or all directories, depending on your web server or hosting company.
``` ini
memory_limit = 128M
register_globals = off
max_execution_time = 600
```
<!-- markdownlint-enable MD046 -->
* CiviCRM is packaged with all the libraries (PEAR etc) that it uses. However a misconfigured or overly restrictive `open_basedir` directive on your web server might interfere with CiviCRM's ability to access some required files or directories. To turn `open_basedir` off, add this to your `vhost.conf` file: `php_admin_value open_basedir none` or ask your host to either turn it off or ensure that it is not preventing access to required directories (e.g. if you move configuration files or temp folders outside your web root). The configuration of sub domains might cause related issues: try installing in the main domain root or a sub folder instead.
* If CiviCRM screens are not displaying properly and/or javascript widgets are not functioning, check your CiviCRM Resource URL (Administer >> System Settings >> Resource URLs). For Joomla installs, it should be something like: `http://example.org/administrator/components/com_civicrm/civicrm`
* Review the [Troubleshooting](../general/troubleshooting.md) page for help with problems you may encounter during the installation.
???+ tldr "About this document"
This guide covers standard installation of CiviCRM on an existing Joomla site. It assumes that you previously completed these tasks:
1. [Install Joomla](https://docs.joomla.org/J3.x:Installing_Joomla), and...
1. [Review the CiviCRM requirements](../general/requirements.md)
!!! note "Path for Joomla"
The rest of these instructions assume that you have Joomla installed in `/var/www/JOOMLA_ROOT`. Adjust paths as needed.
## Get the code {:#download}
All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are included in the compressed CiviCRM distribution files ('tarballs'). Follow these steps to download and install the codebase:
* Download the appropriate tarball file from the [CiviCRM website](https://civicrm.org/download) within your browser. Tarball file-names include the CiviCRM version. For example, `civicrm-x.x.x-joomla.zip`. If you have command line access to your server, use `wget` and the URL of the file to pull a copy directly to your server. Then you can skip the next step.
* Upload this file to a folder in your root Joomla directory. Recommended location: `JOOMLA_ROOT/tmp/`.
* Unzip the package, which will create a directory called: `com_civicrm`. On cPanel, you can use the File Manager's Extract function to unzip the file you uploaded.
Note: when installing a new version over an old one, please first check [troubleshooting resources](#troubleshooting) below.
## Run the installer {:#installer}
* Login to your Joomla Administrator site.
* Go to **Extensions >> Install/Uninstall**.
* Use **Install from Directory** and enter the full path to the un-zipped com_civicrm directory, which should be something like: `JOOMLA_ROOT/tmp/com_civicrm` . In most Joomla installations, the root directory and /tmp/ folder will already populate the "install from directory" field. You must simply add the /com_civicrm/ subfolder at the end. Click Install. If that doesn't work:
* put the full file system path to the `com_civicrm`, something like `/var/www/JOOMLA_ROOT/tmp/com_civicrm/`.
* You should see "Component successfully installed" message.
!!! warning
If you get the following error when installing or upgrading CiviCRM for Joomla - you can downloading the alternate Joomla install file - `civicrm-x.x.x-joomla-alt.zip` - which doesn't require built-in unzip functionality on your server. Then repeat the install steps starting with [running the installer](#installer).
> Your PHP version is missing zip functionality. Please ask your system administrator / hosting provider to recompile PHP with zip support.
Note that missing PHP Zip functionality *will* prevent CiviCRM from installing extensions via the GUI.
## Synchronize the users {:#contacts-users}
Once installed, CiviCRM keeps your Joomla Users synchronized with corresponding CiviCRM contact records. The 'rule' is that there will be a matched contact record for each Joomla user record. Conversely, only contacts who are authenticated users of your site will have corresponding Joomla user records.
When CiviCRM is installed on top of an existing Joomla site, a special CiviCRM Administrative feature allows you to automatically create CiviCRM contacts for all existing Joomla users:
* Login to your Joomla site with an administrator-level login
* Click the **Components > CiviCRM > CiviCRM Home** link in the main navigation block
* Click **Administer > Users and Permissions > Synchronize Users-to-Contacts**
## Addenda
### Troubleshooting {:#troubleshooting}
* If the CiviCRM component does not install correctly (for example you get a blank screen instead of the confirmation page), delete the `~/components/com_civicrm` and `~/administrator/components/com_civicrm` and `~/media/civicrm directories` manually and then try each of the following before attempting to reinstall:
* In your `php.ini` file or in `.htaccess` file in the Joomla root folder (if your server allows it), increase the `max_execution_time` to `600` and memory limit to more than 64M. Add the following to the `.htaccess` file in your Joomla root folder
<!-- markdownlint-disable MD046 -->
``` htaccess
php_value memory_limit 128M
php_value register_globals off
php_value max_execution_time 600
```
If you can't change the `.htaccess` file you can add a php.ini (or `.user.ini`) file in Joomla root folder or all directories, depending on your web server or hosting company.
``` ini
memory_limit = 128M
register_globals = off
max_execution_time = 600
```
<!-- markdownlint-enable MD046 -->
* CiviCRM is packaged with all the libraries (PEAR etc) that it uses. However a misconfigured or overly restrictive `open_basedir` directive on your web server might interfere with CiviCRM's ability to access some required files or directories. To turn `open_basedir` off, add this to your `vhost.conf` file: `php_admin_value open_basedir none` or ask your host to either turn it off or ensure that it is not preventing access to required directories (e.g. if you move configuration files or temp folders outside your web root). The configuration of sub domains might cause related issues: try installing in the main domain root or a sub folder instead.
* If CiviCRM screens are not displaying properly and/or javascript widgets are not functioning, check your CiviCRM Resource URL (Administer >> System Settings >> Resource URLs). For Joomla installs, it should be something like: `http://example.org/administrator/components/com_civicrm/civicrm`
* Review the [Troubleshooting](../general/troubleshooting.md) page for help with problems you may encounter during the installation.
# Drupal Multisite
## Install the first site
Say `site1.example.com` which would be same as any other normal CiviCRM installation.
It is not necessary to for the top level site to be multisite aware but if you want it to be then enable multisite by visiting `civicrm/admin/setting/preferences/multisite?reset=1`. If you do this you should also grant the associated permission in Drupal: "CiviCRM: administer Multiple Organizations" to your developers or website administrators.
Create a new contact to be the domain contact for the new domain (note steps 2 & 3 can now be done with the `MultisiteDomain.create` api which is part of the extension)
## Create new database records
You can create the database records in this section automatically if you prefer by installing the [Multisite Permissioning](https://civicrm.org/extensions/multisite-permissioning) extension and using the `MultisiteDomain.create` api as described in the [extension's README file](https://lab.civicrm.org/extensions/multisite/-/blob/master/README.md).
### Create the "Default Organization" record
Each CiviCRM domain must have its own [Default Organization](https://docs.civicrm.org/sysadmin/en/latest/setup/#site-configuration). Create a new Organization record to represent the default organization of the new domain.
### Create the domain record
Insert a new domain record into the CiviCRM database. For example if your new contact is 555
```sql
INSERT INTO `civicrm_domain` (
`name`,
`description`,
`version`,
contact_id)
SELECT
'site 2',
'second test site',
cd.version,
555
FROM civicrm_domain cd
WHERE cd.id = 1;
```
### Build the navigation links for new domain
Modify `civicrm_codebase/sql/civicrm_navigation.mysql` file and specify new domain, e.g
```sql
SELECT @domainID := id
FROM civicrm_domain
WHERE `name` = 'Default Domain Name';
```
To
```sql
SELECT @domainID := id
FROM civicrm_domain
WHERE `name` = 'site 2';
```
OR
```sql
SET @domainID = 2;
```
And import this file to your CiviCRM database.
## Create the new site
Setup the CMS for the second site. In some cases, you will install a new instance of the CMS. You can also use the existing CMS if you are using the [Domain Access](https://www.drupal.org/project/domain) module for Drupal.
### Locate the settings file for the second site
Depending on how you would like to install CiviCRM for site 2, proceed to one of the following steps:
### Manual CiviCRM installation for site2.example.com.
* Copy CiviCRM settings file from previous site (site1) to the new site (site2).
```
cp sites/site1.example.com/civicrm.settings.php sites/site2.example.com/
```
Note `sites/site2.example.com/civicrm.settings.php` is your new settings file which needs to be modified.
* The sites can share a single instance of the CiviCRM code in sites/all/modules/ directory if they are using the same CMS.
* Modify `sites/site2.example.com/civicrm.settings.php` file to adjust settings like `CIVICRM_TEMPLATE_COMPILEDIR`, `CIVICRM_UF_BASEURL` as per new site.
* Enable the CiviCRM module through Drupal, at Site building -> Modules ( `/admin/build/modules` ).
### Drupal with the Domain Access module
!!! note
If you're using Drupal with Domain Access, consider installing the [Domain Access CiviCRM](https://civicrm.org/extensions/domain-access-civicrm) module if users might be creating new Drupal accounts via CiviCRM profiles.
Similar to WordPress, with Domain Access module there is only one copy of the codebase, and one copy of `civicrm.settings.php`.
The easiest is to assign the same domain_id's in Drupal and CiviCRM, then you can just replace this line:
```php
define( 'CIVICRM_DOMAIN_ID' , 1 );
```
With:
```php
if (!function_exists('domain_get_domain')) {
// The Domain Access module is not enabled
define('CIVICRM_DOMAIN_ID', 1);
}
else {
// Get domain_id from the Drupal setup - Drupal and CiviCRM domain IDs MUST match!
$domain = domain_get_domain();
define('CIVICRM_DOMAIN_ID', $domain['domain_id']);
}
```
Otherwise you must replace the above line with a conditional similar to:
```php
//define the per-domain settings here first in case we're running from CLI (e.g. bin/csv/import.php)
if(empty($_SERVER['SERVER_NAME'])) {
define( 'CIVICRM_DOMAIN_ID', 1 );
define( 'CIVICRM_UF_BASEURL' , 'http://example.local/' );
}
```
```php
switch ($_SERVER['SERVER_NAME']) {
case 'example.local':
define( 'CIVICRM_DOMAIN_ID', 1 );
define( 'CIVICRM_UF_BASEURL' , 'http://example.local/' );
break;
case 'cdp.example.local':
define( 'CIVICRM_DOMAIN_ID', 2 );
define( 'CIVICRM_UF_BASEURL' , 'http://cdp.example.local/' );
break;
case 'svp.example.local':
define( 'CIVICRM_DOMAIN_ID', 3 );
define( 'CIVICRM_UF_BASEURL' , 'http://svp.example.local/' );
break;
}
```
With either of the above, skip the following "Register a new domain" step.
### Auto + manual installation for site2.example.com
* Use CiviCRM installer for installing CiviCRM for `site2.example.com`. Specify a new CiviCRM database which can be dropped later.
Note `sites/site2.example.com/civicrm.settings.php` is your new settings file which needs to be modified.
* Adjust `CIVICRM_DSN` setting to use the CiviCRM database used by site1. Drop the new CiviCRM database previously created.
* The sites can share a single instance of the CiviCRM code in `sites/all/modules/` directory.
### Register a new domain
Modify located `civicrm.settings.php` file (for site2) to change following line -
```php
define( 'CIVICRM_DOMAIN_ID' , 1 );
```
to reflect the id of inserted domain record in step2. Assuming id is 2 for newly inserted record, the line would change to -
```php
define( 'CIVICRM_DOMAIN_ID' , 2 );
```
### Register a domain group
In multi-org installation, you can configure a group for each multisite aware domain (not necessarily including the top level domain). When you login to the site and go to "manage groups" screen, you will notice a group with the name as that of domain. System requires you to register this master group responsible for holding sub-groups/contacts. Contacts using the site will be automatically added to the site. You need to set a different group for each site at `civicrm/admin/setting/preferences/multisite?reset=1`
Note that it is valid not to enable multisite on the top level domain (which is unaware of the subdomains). This improves performance by not creating such a deep hierarchy of groups
### Associate an organization with the master group
To represent a multi-org hierarchy, an organization could be connected to the master group (one-to-one relationship). Add a record in the civicrm_group_organization table to represent this (or use the MultisiteDomain.create api to create your domain). This record only has value if the multisite extension is enabled.
### Configure Access Control
Here we restrict users on Site N to contacts in Site N's Site Group.
There is a separate extension called **multisite** that automatically implements CiviCRM access control for multisite installations, such that normal users on Site N are restricted to contacts in Site N's Site Group. Note that users with permission to view or edit all contacts bypass this access control.
# Multisite Installation
This section explains how to use one CiviCRM database with multiple sites.
This can be done in either [Drupal](drupal.md) or [WordPress](wordpress.md).
# WordPress Multisite, CiviCRM Multi-Domain Setup
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.
## Install WordPress Single Site as normal
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 );
```
Run WordPress Multisite "Network Setup" under Tools
![image-20201027174136563](../images/wpms/image-20201027174136563.png)
- 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:
```php
/**
* 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' );
}
```
- 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(
// 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'];
}
}
// Trigger Multisite discovery immediately.
civicrm_multisite_set_domain_data_for_site();
```
- Now go back and edit `civicrm.settings.php`:
* Around line 80 or so, comment out the paths and URL settings:
```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';
*/
```
- 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)
```php
/*
if (!defined('CIVICRM_UF_BASEURL')) {
define( 'CIVICRM_UF_BASEURL' , 'https://wpms.test');
}
*/
// Include the Domain settings file.
require_once 'civicrm.domains.php';
```
- Now back to WordPress Network Admin, _CiviCRM Admin Utilities_, "Domain" tab
![image-20201027180252729](../images/wpms/image-20201027180252729.png)
- Create a new _CiviCRM_ Domain
![image-20201027180332753](../images/wpms/image-20201027180332753.png)
- Activate _CiviCRM_ on Site 2
- Go To Site 2 Settings menu --> _CiviCRM Admin Utilities_ --> "Domain" tab
![image-20201027183932098](../images/wpms/image-20201027183932098.png)
- Repeat for other Domains
## Permissions
- You will need to set permissions to limit access. Administrators and Network Admins will have pre-defined rights.
![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.
## Scope of this guide and alternative installation methods
This guide covers standard installation of CiviCRM for production use. For installing a development environment, refer to the [section on Buildkit in the Developer Documentation](https://docs.civicrm.org/dev/en/latest/tools/buildkit/).
## Before installing
1. Ensure that your system meets the [requirements](../general/requirements.md).
1. Install WordPress by referring to the [WordPress Installation Guide](https://wordpress.org/support/article/how-to-install-wordpress/) if needed.
!!! note "Path for WordPress"
The rest of these instructions assume that you have WordPress installed in `/var/www/wordpress`. Adjust paths as needed.
## Download and Un-zip CiviCRM Code
All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are included in the compressed CiviCRM distribution files ('zips'). Follow these steps to download and install the codebase:
* Download the appropriate zip file from the [CiviCRM website](https://civicrm.org/download) with your browser. The zip file-names include the CiviCRM version. For example, **civicrm-x.x.x-wordpress.zip.**
* 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:
1. Move into WordPress's plugin directory
``` bash
cd /var/www/wordpress/wp-content/plugins
```
1. wget the file (modify this line to use the current zip file name for the version you want)
``` bash
wget https://download.civicrm.org/civicrm-x.x.x-wordpress.zip
```
* Extract (aka: unzip, unpack) the codebase into the wordpress/wp-content/plugins directory.
1. Move to the wordpress/wp-content/plugins directory (if not already there)
<!-- markdownlint-disable MD046 -->
``` bash
cd /var/www/wordpress/wp-content/plugins
```
<!-- markdownlint-enable MD046 -->
1. Un-zip the file (modify this line with the actual downloaded filename)
<!-- markdownlint-disable MD046 -->
``` bash
unzip civicrm_download_file.zip
```
<!-- markdownlint-enable MD046 -->
* You should now have a `/var/www/wordpress/wp-content/plugins/civicrm` directory containing `civicrm.php`, `README.txt` and another civicrm directory (which in turn contains bin, CRM, sql, templates, etc.).
## Install localization files (only for non-English sites) {:#i18n}
If using CiviCRM in another language than English, see the [internationalisation and localisation](../general/i18n_l10n.md) page about how to install files for running CiviCRM in other languages.
## Enable CiviCRM plugin and run installer
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`.
* Login to your WordPress site with Administrator level permissions.
* Go to plugins page: `https://example.org/wp-admin/plugins.php`.
* Click the **Activate** link to activate the CiviCRM plugin.
* Then go to **Settings > CiviCRM Installer**: `https://example.org/wp-admin/options-general.php?page=civicrm-install`
* In version 4.7 and above you will see a link on the wp-admin page to the Installer screen
* You should see the **CiviCRM Installer** screen.
* If you see any errors, check the **Requirements** details at the bottom of the page for more information. You will need to correct any issues before continuing.
* CiviCRM Database Settings.
* Initially, the installer will default to using the existing WP database for the CiviCRM data. You can change this if you require.
!!! tip "Where Should I Store CiviCRM Data?"
CiviCRM may be configured to use your existing WordPress database, or a separate (new) database. Using a separate database is generally preferred - as it makes backups and upgrades easier. The installer will create a new database for CiviCRM automatically if you enter a database name that doesn't already exist on your database server AND the database user you enter has permission to create databases. In case the installer does not automatically create a new database, simply create a new one following the same process as creating a new database for WordPress.
* Fill in the WordPress Database Settings for your existing WordPress database. CiviCRM will fill in the WP database settings, you can change these if you want to use a separate database.
!!! tip "Loading Sample Data"
The Installer includes an option to load a set of sample contact, group, and relationship data by default. Sample data can provide a useful head-start in learning to use CiviCRM. However, if you do NOT want the sample data to be loaded, just uncheck **Load sample data** under **Other Settings**.
* Select the appropriate language for the base installation. You will be able to add other languages after the installation for multi-lingual sites.
* Click the **Check Requirements and Install CiviCRM** button.
* The installer will configure your databases, create the settings file and will redirect to success message.
* If you still see a red bar with the message "These database details don't appear to be correct." - check the Database Details section below your settings for specific errors and problems. Once you correct these problems, click "Recheck requirements" to verify your settings before continuing.
* If you are on a Windows machine and get the message:
> "The user account used by your web-server needs to be granted write access to the following directory in order to configure the CiviCRM settings file: `C:<wordpress path>/wp-content/plugins/civicrm/`"
even after changing directory permission in Explorer, see [the permissions page](../general/permissions.md) for instructions on how to set permissions on Linux, MacOS and Windows.
* Once you see the green "You're ready to install!" message - you can click **Check Requirements and Install CiviCRM**
## Locate and Backup the CiviCRM settings file
After installation, a configuration file will have been created by CiviCRM at: `<wordpress>/wp-content/uploads/civicrm/civicrm.settings.php`
It is critical you make a copy of this file and save as a backup in a safe location. This file contains passwords and other critical information, take precautions to secure the copy from prying eyes.
Should an upgrade fail, you will need this backup copy to restore your site.
## Enabling Cleaner URLs for WordPress
* Starting in Version 5.13.x CiviCRM now can support "Clean URLs" for WordPress front-end (user-facing) pages.
* By default CiviCRM URLs are in the format of `https://example.org/civicrm?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1` for a Contribution Page. With clean URLs enabled:
* A Contribution Page will have the format of `https://example.org/civicrm/contribute/transact/?reset=1&id=1`.
* Profile Pages can be accessed at `https://example.org/civicrm/profile/edit/?gid=1&reset=1` or `https://example.org/civicrm/profile/create/?gid=1&reset=1`.
* Listings would be at `https://example.org/civicrm/profile/?gid=1&reset=1`.
* The User's Contact Dashboard can be accessed at `https://example.org/civicrm/user/?reset=1`.
* To Enable Cleaner URLs , start by backing up your `civicrm.settings.php` file as detailed in the "Locate and Backup the CiviCRM settings file" section above.
* Then find this section of code in `civicrm.settings.php` On a default install it should be around line 480
<!-- markdownlint-disable MD046 -->
``` php
if (!defined('CIVICRM_CLEANURL')) {
if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
define('CIVICRM_CLEANURL', 1 );
}
elseif ( function_exists('config_get') && config_get('system.core', 'clean_url') != 0) {
define('CIVICRM_CLEANURL', 1 );
}
else {
define('CIVICRM_CLEANURL', 0);
}
}
```
<!-- markdownlint-enable MD046 -->
* Replace the above code with:
<!-- markdownlint-disable MD046 -->
``` php
if (!defined('CIVICRM_CLEANURL')) {
// check for Drupal clean URLs
if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
define('CIVICRM_CLEANURL', 1 );
}
elseif ( function_exists('config_get') && config_get('system.core', 'clean_url') != 0) {
define('CIVICRM_CLEANURL', 1 );
}
// check for WordPress clean URLs
elseif( function_exists('get_option') && get_option('permalink_structure') != '' ) {
define('CIVICRM_CLEANURL', 1 );
}
else {
define('CIVICRM_CLEANURL', 0 );
}
}
```
<!-- markdownlint-enable MD046 -->
* You will need to go to **Settings >> CMS Database Integration** `https://example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/setting/uf&reset=1` and make sure the base page points to an existing WP page (usually /civicrm)
* You will need to flush rewrite rules in WordPress for clean URLs to work. Visit the Permalinks settings page to trigger this Go to **Settings >> Permalinks** The URL will be `https://example.org/wp-admin/options-permalink.php`
. ![WordPress Permalink settings.](../images/wp-permalinks.png)
* Now Cleaner URLs will be enabled. Enabling Cleaner URLs does not change how shortcodes work in CiviCRM and existing "Old" style URLs will still work
## Create CiviCRM Contacts for Existing WordPress Users
Once installed, CiviCRM keeps your WordPress Users synchronized with corresponding CiviCRM contact records. The 'rule' is that there will be a matched contact record for each WordPress user record. Conversely, only contacts who are authenticated users of your site will have corresponding WordPress user records.
When CiviCRM is installed on top of an existing WordPress site, a special CiviCRM Administrative feature allows you to automatically create CiviCRM contacts for all existing WordPress users:
* Login to your WordPress site with an administrator-level login
* Click the **CiviCRM** link in the main navigation block
* (If your WordPress site makes use of the `db_prefix` setting (in `settings.php`), in de top bar click **Administer » System Settings » CMS Database Integration** , and update the box for the WordPress Users Table Name so that it includes the prefix.)
* Click **Administer** in the menu bar
* Click **Users and Permissions** from the drop-down menu, then select **Synchronize Users to Contacts**.
## Review the Configuration 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
There should now be a **CiviCRM** link in your WordPress menu. Click that link and the CiviCRM Menu, Shortcuts, Search and New Individual Blocks should appear. You can now explore CiviCRM end-user features and begin configuring CiviCRM for your site/organization needs.
## Using Encryption with MySQL
???+ tldr "About this document"
This guide covers standard installation of CiviCRM on an existing WordPress site. It assumes that you previously completed these tasks:
1. [Install WordPress](https://wordpress.org/support/article/how-to-install-wordpress/), and...
1. [Review the CiviCRM requirements](../general/requirements.md)
??? tldr "Alternative: Civibuild for developers"
If you plan to develop patches for CiviCRM on WordPress, then please read the [Developer Guide](https://docs.civicrm.org/dev/en/latest) for information about [Buildkit](https://docs.civicrm.org/dev/en/latest/tools/buildkit/) and [civibuild](https://docs.civicrm.org/dev/en/latest/tools/civibuild/).
!!! note "Path for WordPress"
The rest of these instructions assume that you have WordPress installed in `/var/www/wordpress`. Adjust paths as needed.
## Get the code {:#download}
All CiviCRM code and packages used by CiviCRM (such as PEAR libraries) are included in the compressed CiviCRM distribution files ('zips'). Follow these steps to download and install the codebase:
* Download the appropriate zip file from the [CiviCRM website](https://civicrm.org/download) with your browser. The zip file-names include the CiviCRM version. For example, **civicrm-x.x.x-wordpress.zip.**
* 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`
!!! 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:
1. Move into WordPress's plugin directory
``` bash
cd /var/www/wordpress/wp-content/plugins
```
1. wget the file (modify this line to use the current zip file name for the version you want)
``` bash
wget https://download.civicrm.org/civicrm-x.x.x-wordpress.zip
```
* Extract (aka: unzip, unpack) the codebase into the wordpress/wp-content/plugins directory.
1. Move to the wordpress/wp-content/plugins directory (if not already there)
<!-- markdownlint-disable MD046 -->
``` bash
cd /var/www/wordpress/wp-content/plugins
```
<!-- markdownlint-enable MD046 -->
1. Un-zip the file (modify this line with the actual downloaded filename)
<!-- markdownlint-disable MD046 -->
``` bash
unzip civicrm_download_file.zip
```
<!-- markdownlint-enable MD046 -->
* You should now have a `/var/www/wordpress/wp-content/plugins/civicrm` directory containing `civicrm.php`, `README.txt` and another civicrm directory (which in turn contains bin, CRM, sql, templates, etc.).
## 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. 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
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`.
* Login to your WordPress site with Administrator level permissions.
* Go to plugins page: `https://example.org/wp-admin/plugins.php`.
* Click the **Activate** link to activate the CiviCRM plugin.
* Then go to **Settings > CiviCRM Installer**: `https://example.org/wp-admin/options-general.php?page=civicrm-install`
* In version 4.7 and above you will see a link on the wp-admin page to the Installer screen
* You should see the **CiviCRM Installer** screen.
* If you see any errors, check the **Requirements** details at the bottom of the page for more information. You will need to correct any issues before continuing.
* CiviCRM Database Settings.
* Initially, the installer will default to using the existing WP database for the CiviCRM data. You can change this if you require.
!!! tip "Where Should I Store CiviCRM Data?"
CiviCRM may be configured to use your existing WordPress database, or a separate (new) database. Using a separate database is generally preferred - as it makes backups and upgrades easier. The installer will create a new database for CiviCRM automatically if you enter a database name that doesn't already exist on your database server AND the database user you enter has permission to create databases. In case the installer does not automatically create a new database, simply create a new one following the same process as creating a new database for WordPress.
* Fill in the WordPress Database Settings for your existing WordPress database. CiviCRM will fill in the WP database settings, you can change these if you want to use a separate database.
!!! tip "Loading Sample Data"
The Installer includes an option to load a set of sample contact, group, and relationship data by default. Sample data can provide a useful head-start in learning to use CiviCRM. However, if you do NOT want the sample data to be loaded, just uncheck **Load sample data** under **Other Settings**.
* Select the appropriate language for the base installation. You will be able to add other languages after the installation for multi-lingual sites.
* Click the **Check Requirements and Install CiviCRM** button.
* The installer will configure your databases, create the settings file and will redirect to success message.
* If you still see a red bar with the message "These database details don't appear to be correct." - check the Database Details section below your settings for specific errors and problems. Once you correct these problems, click "Recheck requirements" to verify your settings before continuing.
* If you are on a Windows machine and get the message:
> "The user account used by your web-server needs to be granted write access to the following directory in order to configure the CiviCRM settings file: `C:<wordpress path>/wp-content/plugins/civicrm/`"
even after changing directory permission in Explorer, see [the permissions page](../general/permissions.md) for instructions on how to set permissions on Linux, MacOS and Windows.
* Once you see the green "You're ready to install!" message - you can click **Check Requirements and Install CiviCRM**
## Backup the settings file
The installer created a configuration file at `<wordpress>/wp-content/uploads/civicrm/civicrm.settings.php`
It is critical you make a copy of this file and save as a backup in a safe location. This file contains passwords and other critical information, take precautions to secure the copy from prying eyes.
Should an upgrade fail, you will need this backup copy to restore your site.
<!-- Is the above still true for new installations in Civi 4.7/5.x? Makes sense if 4.6, which bizarrely placed the config-file in the code-directory.But in 4.7+?? -->
## Synchronize the users {:#contacts-users}
Once installed, CiviCRM keeps your WordPress Users synchronized with corresponding CiviCRM contact records. The 'rule' is that there will be a matched contact record for each WordPress user record. Conversely, only contacts who are authenticated users of your site will have corresponding WordPress user records.
When CiviCRM is installed on top of an existing WordPress site, a special CiviCRM Administrative feature allows you to automatically create CiviCRM contacts for all existing WordPress users:
* Login to your WordPress site with an administrator-level login
* Click the **CiviCRM** link in the main navigation block
* (If your WordPress site makes use of the `db_prefix` setting (in `settings.php`), in de top bar click **Administer » System Settings » CMS Database Integration** , and update the box for the WordPress Users Table Name so that it includes the prefix.)
* Click **Administer** in the menu bar
* Click **Users and Permissions** from the drop-down menu, then select **Synchronize Users to Contacts**.
## 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
There should now be a **CiviCRM** link in your WordPress menu. Click that link and the CiviCRM Menu, Shortcuts, Search and New Individual Blocks should appear. You can now explore CiviCRM end-user features and begin configuring CiviCRM for your site/organization needs.
## Addenda
### TLS for MySQL
If your MySQL database is hosted on a different machine than your web server, or if your host requires it, you can use TLS to encrypt the connection between the database and the web server.
See [TLS for MySQL](/general/mysql_tls/) for introductory concepts and the settings for the CiviCRM database. For the Wordpress database you can add the following line to wp-config.php:
See [TLS for MySQL](../general/mysql_tls.md) for introductory concepts and the settings for the CiviCRM database. For the Wordpress database you can add the following line to wp-config.php:
* `define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);`
## Troubleshooting Resources {:#troubleshooting}
* Review the [troubleshooting](../general/troubleshooting.md) page for help with problems you may encounter during the installation.
### Troubleshooting {:#troubleshooting}
* Review the [troubleshooting](../general/troubleshooting.md) page for help with problems you may encounter during the installation.
site_name: 'CiviCRM Installation Guide'
site_url: 'https://docs.civicrm.org/installation/en/stable/'
repo_url: 'https://lab.civicrm.org/documentation/docs/installation'
repo_name: GitLab
site_description: 'This guide is aimed at CiviCRM users and implementors who would like to learn how to install and setup CiviCRM.'
site_author: 'The CiviCRM community'
site_name: CiviCRM Installation Guide
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.
site_author: The CiviCRM Community
theme:
name: material
icon:
repo: fontawesome/brands/gitlab
markdown_extensions:
- attr_list
- admonition
......@@ -26,16 +28,17 @@ 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: drupal8/index.md
# - Install CiviCRM on Drupal 9: drupal9/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
- Internationalisation: general/i18n_l10n.md
- Unicode PDF Fonts: general/unicode_pdf.md
- TLS for MySQL: general/mysql_tls.md
- CLI Installer: general/cli-cv.md
- Troubleshooting: general/troubleshooting.md
- Planning:
- Identifying your needs: planning/index.md
......@@ -43,5 +46,7 @@ nav:
- Hosting: planning/hosting.md
- Choosing a CMS: planning/cms.md
- Transitioning to CiviCRM: planning/transition.md
- Multisite installation:
- Multisite installation: multisite/index.md
- Drupal: multisite/drupal.md
- WordPress: multisite/wordpress.md
drupal7 drupal