Can anyone tell me where I can find step by step instructions for setting up a multisite? I've found references that indicate Piwigo supports multisites, but I can't find any clear instructions that explain how to do it.
What I would like to do is set up two galleries on my website that are accessed via two different urls, i.e.:
http://mywebsite.com/gallery/
http://mywebsite.com/gallery2/
Is this possible?
Thanks,
Bernie
Hi Bernie,
Yes, it is possible. This topic will be a good excuse to write a clean "quick start" for multisite on Piwigo!
Let's say you have Piwigo files on /var/www/piwigo
In your Apache configuration file, you need something like :
Alias /gallery /var/www/piwigo Alias /gallery2 /var/www/piwigo
* create directories /var/www/piwigo/local-gallery and /var/www/piwigo/local-gallery2, with write access for www-data (chmod 0777 if you don't understand what www-data is)
* create file /var/www/piwigo/local/config/multisite.inc.php with the following content:
<?php if (preg_match('#^/gallery#', $_SERVER['SCRIPT_NAME'])) { $conf['local_dir_site'] = 'local-gallery/'; } elseif (preg_match('#^/gallery2#', $_SERVER['SCRIPT_NAME'])) { $conf['local_dir_site'] = 'local-gallery2/'; } $conf['upload_dir'] = $conf['local_dir_site'].'upload'; ?>
Then open http://mywebsite.com/gallery/ in your web browser, follow installation procedure and repeat the procedure for gallery2. The 2 Piwigo galleries can use the same database, but change the prefix for tables.
Offline
Those are exactly the type of instructions I was looking for. I won't be working on this quite yet, but I look forward to setting up Piwigo on my site. Thanks for your response.
Bernie
Unfortunately, the steps you gave are not working. These are the steps I went through and the error that occurs.
1. I created the local-gallery and local-gallery2 folders with write access.
2. I created multisite.inc.php and uploaded it to piwigo/local/config.
3. I went to http://mywebsite.com/gallery/ where I was presented with the installation page. I entered the information and ran the installation. Then I received a page with the following error:
Creation of config file local/config/database.inc.php failed.
You can download the config file and upload it to local/config directory of your installation.
An alternate solution is to copy the text in the box above and paste it into the file "local/config/database.inc.php" (Warning : database.inc.php must only contain what is in the textarea, no line return or space character)
Why is the installation trying to save the file to local/config/database.inc.php? Shouldn't it be saving the file to local-gallery/config/database.inc.php?
After doing this, if I browse to http://mywebsite.com/gallery/, I am presented with the installation page again.
Am I missing something?
Bernie
What I ended up doing is copying the contents of the local/ folder to the local-gallery/folder and then I corrected the database.inc.php file. Now things appear to be working. It seems to me there may be a problem with the installation not saving the database.inc.php to the correct folder location.
Bernie
Bernie wrote:
Creation of config file local/config/database.inc.php failed.
The error message is misleading. Actually Piwigo tries to write local-gallery/config/database.inc.php but the error message says something else. Trust me, install.php takes the $conf['local_dir_site'] configuration parameter into account (this is how Piwigo.com works and there are new installs every day ;-)
The problem was that Piwigo had no write access to local-gallery/config/database.inc.php
Offline
Hi,
is there a way to do this without having access to the apache config file?
The code has changed on Piwigo 2.4 (no more multisite.inc.php file), see the wiki : Multiple Site
Offline