Requirements: installation

Languages

PHP

Node.js

MySQL

PHP extensions

You will need to install php8.1-xml to manage xml files and php8.1-gd to manage images.

sudo apt-get install -y php8.1-xml php8.1-gd

Image tools

For spatie/media-library can optimize images, you could have to install some tools for production server.

sudo apt-get install -y jpegoptim optipng pngquant gifsicle webp
npm install -g svgo

PDF support optional

PDF can be used as format but to extract cover from PDF, you need to have ImageMagick. So you have to install locally imagemagick

sudo apt install -y imagemagick

And you have to install PHP imagick to use ImageMagick from pecl or manually by downloading .tgz file.

sudo pecl install imagick

Check if PHP can use ImageMagick

php -m | grep imagick

You have to get this result imagick

CBR support optional

CBR files can be used only if your system can manage .rar files

sudo apt install -y rar

And you have to install PHP rar from pecl

sudo pecl install rar

Troubles with rar

...or, if you have some errors, manually by clone this repository

cd ~
git clone https://github.com/cataphract/php-rar
cd php-rar
phpize
./configure
make
make install
cd ..

If you haven't errors, you could find ~/php-rar/modules/rar.so. Now you can add manually rar.so to pecl.

Find pecl directory for PHP

pecl config-get ext_dir

And just copy rar.so into this directory

cp ~/php-rar/modules/rar.so /usr/local/lib/php/pecl/YOUR_VERSION

Now, you have to find your php.ini

php --ini

For example, I've this result Loaded Configuration File: /usr/local/etc/php/8.1/php.ini

You can edit it

vim /your/path/to/php.ini

You can search extension section or just add at the end

php.ini
extension=rar.so

Check if your extension_dir have right value : extension_dir = "/usr/local/lib/php/pecl/YOUR_VERSION".

And now you can restart PHP services.

brew services restart php@8.1

You can remove php-rar

rm -r ~/php-rar

Check if rar works

To know if PHP can use .rar files, just use

php -m | grep rar

You have to get this result: rar

Package managers

pnpm

requirement npm
npm i -g pnpm

Composer

requirement php

You can download composer from official website

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# check SHA
php composer-setup.php
php -r "unlink('composer-setup.php');"

Add to bin

sudo mv composer.phar /usr/local/bin/composer
sudo chown -R $USER ~/.config/composer/

Add to PATH

export PATH=~/.config/composer/vendor/bin:$PATH
Edit this page on GitHub Updated at Tue, Apr 12, 2022