User Tools

Piwigo

Note: since i don't use this service anymore, this page might be not updated.

Piwigo is a long-lasting, solid and versatile photo gallery software. It is based on PHP and it's been around 21+ years, so for some it might be considered as ancient, but it's not and while maybe not fancy based on new technology, it's under active development today and widely used all around the world.

There are also mobile apps associated to Piwigo that can take care of backup and mobile editing.

Installation

Piwigo is PHP based, so you need to follow Using independent PHP for different services to create an instance of PHP-FPM for Piwigo. I will assume you have your PHP-FPM up and running before going forward.

Prerequisites · setup

Ensure you have PHP emerged with the following USE flags, if you don't have it already, emerge it again:

echo dev-lang/php exif fpm gd mysqli >> /etc/portage/package.use/piwigo
emerge -vp php
emerge -vp dev-php/pecl-imagick

Also emerge pecl-imagick to add ImageMagick support.

Initial setup

Now, create the usual service user that i will call piwigo. This user should be member of the photos group:

useradd -d /data/daemons/piwigo -m -g photos piwigo

The full Piwigo installation guides are here.

You need to download and unpack Piwigo latest release:

su - piwigo
wget -O piwigo.zip "https://piwigo.org/download/dlcounter.php?code=latest"
unzip piwigo.zip

This will create a subfolder called piwigo.

Database setup

See MariaDB / MySQL to setup the database.

You need to create a database called piwigo with a user called piwigo with a strong enough password.

Ensure your database is running!

Reverse Proxy setup

piwigo.conf
location /piwigo/ {
        root /data/daemons/piwigo/;
        index index.php;

        location ~ /.*\.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_pass 127.0.0.1:9002;
                fastcgi_read_timeout 300;
        }
}

Make sure the port (9002) matches your PHP-FPM port!

Web installation

Open your broser to https://mydomain.com/piwigo/index.php and follow the instructions there!

Make sure to specify 127.0.0.1 instead of localhost in the database address.

Permissions, securization and tuning

The piwigo home folder comes with some weird defaults, you should remove permissions for others:

chmod o-w /data/daemons/piwigo/* -R

Your piwigo user and PHP-FPM user are all owned by the same user (if you followed me properly!) so there is no need for giving write permissions to others.

You want to increase your default PHP memory usage or Piwigo might give error with large collections.

Edit memory_limit in your php.ini (edit the one associated to the correct PHP FPM instance!). A good value might be 520M or even higher.

Edit max_execution_time in your php.ini to 300.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information