PHP

Activer des modules supplémentaires requis par Pixelfed :

sudo a2enmod rewrite proxy proxy_fcgi

Redémarrer le service :

sudo systemctl restart apache2

Installation

Après avoir vérifié que le système est à jour, ajoutez les sources du dépôt php. Valider par Entrée si nécessaire :

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2

Installer php et son module Apache :

sudo apt install -y php8.4-cli libapache2-mod-php8.4

Installer les modules supplémentaires requis par Pixelfed :

sudo apt install -y php8.4-{bcmath,ctype,curl,exif,gd,iconv,imagick,intl,json,mbstring,mysqli,openssl,pdo_mysql,redis,tokenizer,xml,zip}
Au moment de la rédaction de ce tutoriel (août 2025), la dernière version de php est la 8.4 ; vérifiez si vous devez migrer vers une nouvelle version.
La version installée actuellement est donnée par php -v:
PHP 8.4.11 (cli) (built: Aug  3 2025 08:42:27) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.11, Copyright (c), by Zend Technologies
    

PHP-FPM

sudo apt install -y php-fpm

Ajouter un répertoire et changer le propriétaire :

sudo mkdir -p /run/php-fpm
sudo chown www-data:www-data /run/php-fpm

Configurer un pool :

sudo cp /etc/php/8.4/fpm/pool.d/www.conf /etc/php/8.4/fpm/pool.d/pixelfed.conf
sudo nano /etc/php/8.4/fpm/pool.d/pixelfed.conf

Modifier les lignes non commentées :

; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[pixelfed]
; Unix user/group of the child processes. This can be used only if the master
; process running user is root. It is set after the child process is created.
; The user and group can be specified either by their name or by their numeric
; IDs.
; Note: If the user is root, the executable needs to be started with
;       --allow-to-run-as-root option to work.
; Default Values: The user is set to master process running user by default.
;                 If the group is not set, the user's group is used.
user = pixelfed-user
group = pixelfed-user

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
;                            a specific port;
;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php-fpm/pixelfed.sock
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions. The owner
; and group can be specified either by name or by their numeric IDs.
; Default Values: Owner is set to the master process running user. If the group
;                 is not set, the owner's group is used. Mode is set to 0660.
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

Enregistrer et quitter Nano.
Éditer le fichier php.ini:

sudo nano /etc/php/8.4/apache2/php.ini

Chercher et modifier les valeurs de ces paramètres :

; Maximum execution time of each script, in seconds
; https://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; https://php.net/max-input-time
max_input_time = 300
; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 512M
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; https://php.net/post-max-size
post_max_size = 1G
; Maximum allowed size for uploaded files.
; https://php.net/upload-max-filesize
upload_max_filesize = 1G

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 500

Imports Instagram

Les imports Instagram sont affectés par ces réglages. Si vous activez les imports, vous devrez augmenter post_max_size à la taille maximale que vous prévoyez pour une archive* Instagram, upload_max_filesize à la taille maximale que vous prévoyez pour chaque photo Instagram, et max_file_uploads au nombre maximal de photos (et non de publications) que vous prévoyez pour une archive Instagram.

Source : Pixelfed Docs

* l'archive est le fichier exporté qui vous est envoyé par Meta, généralement de la forme instagram-nom_utilisateur-AAAA-MM-JJ-hash.zip

Enregitrer et quitter Nano.
Modifier ces même lignes dans le fichier ini de PHP-FPM :

sudo nano /etc/php/8.4/fpm/php.ini

Redémarrer le service PHP-FPM :

sudo systemctl restart php8.4-fpm.service

Composer

cd ~/
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Installer verified devrait s'afficher. Si oui, on installe Composer:

sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer