Disclaimer: This tutorial is mainly aimed at developers who have multiple concrete5 projects in the same development environment.
Every tutorial for running concrete5 centralized for multi-site purposes focuses on the symlinking method which is of course the best approach but not suitable for every environment. For example in Windows environments managing and adding symlinks is not that trivial all the times. This guide provides a way to run multiple concrete5 sites with the same core folder natively with concrete5 configuration.
For the symlink methods, please take a look into the related how-tos of this article.
What this method provides is:
- A way to centralize the core to only one folder in your development environment
- A way to take advantage of a concrete5 core already available in your development web server's other folder
It is not suggested to use this method, as is, in production environment because it assumes that the public assets are already available in a folder served from your server.
For example I use this method myself for my development environment that looks like this:
/dev/php/concrete5/ <-- Latest github version
/dev/php/concrete5.x.x.x/ <-- Official releases
/dev/php/concrete5_packages/ <-- Package development
/dev/php/concrete5_some_random_project/ <-- E.g. some add-on project I'm contributing to
For new projects there's no need / purpose to copy e.g. the latest github version over and over again. Also, as said, it is not as trivial to set symlinks in Windows and you can even do this straight from concrete5, so there's no need to.
What you need to do is for the new project:
- Create the basic concrete5 directory structure and leave /concrete/ folder empty or don't create it
- Download a new dispatcher.php file and extract it in the /concrete/ folder, leave the folder otherwise empty (so it just contains that file)
- The new dispatcher file looks for a startup.php script from your site's /config/ dir, so create that for configuring the centralization
For the /config/startup.php file, add this (kind of) configuration for core centralization:
// Hide "constant already defined" errors when /concrete/config/base.php gets included
ini_set('display_errors', 0);
// I'm using the latest github version core for this project
define('DIR_BASE_CORE', '/dev/php/concrete5/web/concrete');
// From which project I'm serving the static assets
define('ASSETS_URL_WEB', '/concrete5/web');
PLEASE NOTE, that this will not work and will end up in an endless loop if you don't set DIR_BASE_CORE or set it to the /concrete/ directory of your current project. This is because the dispatcher is overridden and it should be included from another REAL concrete-folder.
After that you're ready to use this method. Unfortunately this does not work if you don't have the static assets already available in some other folder your server is serving. This is just a simple way to do it straight from concrete5 without any additional settings.