This is an old revision of the document!
The Multiple site feature, introduced in Piwigo 2.2, is the ability to have several galleries with a single Piwigo installed. This feature is used on Piwigo.com where thousands of galleries run on one Piwigo installation.
Only the files are shared, each gallery has a specific database or a set of tables in the same database if you use a specific table prefix for each gallery.
Download Piwigo and extract files on your web server, in /var/www/piwigo for example.
In your Apache configuration file, you need something like:
Alias /gallery1 /var/www/piwigo Alias /gallery2 /var/www/piwigo
Create directories /var/www/piwigo/gallery1 and /var/www/piwigo/gallery2 and sub-drectories, with write access for www-data (chmod 0777 if you don't understand what www-data is)
mkdir /var/www/piwigo/gallery1 mkdir /var/www/piwigo/gallery1/local mkdir /var/www/piwigo/gallery1/local/config mkdir /var/www/piwigo/gallery1/_data mkdir /var/www/piwigo/gallery1/upload chown -R www-data:www-data /var/www/piwigo/gallery1
Let's do the same for gallery2:
mkdir /var/www/piwigo/gallery2 mkdir /var/www/piwigo/gallery2/local mkdir /var/www/piwigo/gallery2/local/config mkdir /var/www/piwigo/gallery2/_data mkdir /var/www/piwigo/gallery2/upload chown -R www-data:www-data /var/www/piwigo/gallery2
and so on for other sites.
In your local/config/config.inc.php, you need this kind of code:
if (preg_match('#^/gallery1#', $_SERVER['SCRIPT_NAME'])) { $site_dir = './gallery1/'; } elseif (preg_match('#^/gallery2#', $_SERVER['SCRIPT_NAME'])) { $site_dir = './gallery2/'; } define('PWG_LOCAL_DIR', $site_dir.'local/'); $conf['upload_dir'] = $site_dir.'upload/'; $conf['data_location'] = $site_dir.'_data/'; # in case there is a specific configuration file for each "site" @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
The trick is to find how Piwigo can understand if it's currently running gallery1 or gallery2. In this example, we have used the $_SERVER['SCRIPT_NAME'] variable. You can also use an environment variable set by your webserver or the full URL (if you search for a specific sub-domain).
Now you have to go to each Piwigo gallery : http://yourdomain.com/gallery1 and http://yourdomain.com/gallery2 and follow the installation each time.