This is how I managed to install the PHP PECL Yaml extension, which is recommended e.g. by Grav („Installing the native PHP PECL Yaml parser can increase YAML parsing speed by as much as 400%! This is well worth looking at if you are looking for some extra speed.“), on Debian and with PHP7.4-fpm running:
- Backup your server!
- (Changing php or generally server settings is always a delicate issue, so always make sure you have a working backup available before initiating sensitive changes!)
- If you’re using Grav:
- Open the Grav backend
- Go to Tools > Reports
- (You might have to install the „DevTools“ plugin first)
- Check if „PHP yaml“ is already running or not (and if it’s still recommended)
- Connect to your server via SSH
- php -v
- (To check which php-Version is currently in use – if something with PHP 7.4.xx is showing up, the upcoming instructions could be working for you, if not, maybe they’ll work if you change 7.4 in the commands to your php version number in use)
- sudo apt-get -y install gcc make autoconf libc-dev pkg-config
- sudo apt-get -y install libyaml-dev
- sudo apt-get -y install php-pear php7.4-yaml
- sudo pecl install yaml
- sudo touch /etc/php/7.4/cli/conf.d/20-yaml.ini
- sudo touch /etc/php/7.4/fpm/conf.d/20-yaml.ini
sudo bash -c "echo extension=yaml.so > /etc/php/7.4/cli/conf.d/20-yaml.ini"
sudo bash -c "echo extension=yaml.so > /etc/php/7.4/fpm/conf.d/20-yaml.ini"
- sudo service php7.4-fpm restart
- php7.4 -i | grep yaml
- composer install
- If you’re using Grav:
- Open the Grav backend
- Go to Tools > Reports
- (You might have to install the „DevTools“ plugin first)
- Check if „PHP yaml“ is beautifully green and running now
- Check if the websites on your server are still working fine
- (If not, check your php yaml configuration, uninstall yaml again, or restore the backup from step 1)
Thanks to the user and instructions here for making this possible!
Did the instructions work for you? Leave us some stars or a comment: