← ServerPilot Docs

How to Install the PHP YAML Extension

To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.

The PHP YAML extension provides PHP functions for parsing and serializing files and text containing YAML markup.

Installing the YAML Extension on PHP 7.3

This extension does not yet support PHP 7.3.

Installing the YAML Extension on PHP 7.0, 7.1, and 7.2

In the examples shown, replace "7.X" with your app's PHP version (for example, "7.0").

To install the PHP YAML extension on PHP 7.0, PHP 7.1, or PHP 7.2, SSH in to your server as root and first run these commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libyaml-dev

Next, run the following command:

sudo pecl7.X-sp install yaml

When you receive this prompt:

Please provide the prefix of libyaml installation [autodetect] :

press Enter without entering a prefix. This allows the library's location to be autodetected.

Once installed, create a configuration file for the extension and restart PHP by running the following command as root:

sudo bash -c "echo extension=yaml.so > /etc/php7.X-sp/conf.d/yaml.ini"
sudo service php7.X-fpm-sp restart

Installing the YAML Extension on PHP 5.X

In the examples shown, replace "5.X" with your app's PHP version (for example, "5.6").

To install this extension on PHP 5.4, 5.5, or 5.6, first run the following commands as your server's root user:

sudo apt-get install gcc make autoconf libc-dev pkg-config
sudo apt-get install libyaml-dev

Next, run the following command:

sudo pecl5.X-sp install yaml-1.3.0

When you receive this prompt:

Please provide the prefix of libyaml installation [autodetect] :

press Enter without entering a prefix. This allows the library's location to be autodetected.

Once installed, create a configuration file for the extension and restart PHP by running the following command as root:

sudo bash -c "echo extension=yaml.so > /etc/php5.X-sp/conf.d/yaml.ini"
sudo service php5.X-fpm-sp restart

Verifying the PHP YAML Extension Is Installed

You can verify the YAML extension is installed by running this command, where X.Y is your app's PHP version:

phpX.Y-sp -i | grep yaml

You should see output similar to the following:

/etc/php7.0-sp/conf.d/yaml.ini,
yaml
LibYAML Support => enabled
LibYAML Version => 0.1.4
yaml.decode_binary => 0 => 0
yaml.decode_php => 0 => 0
yaml.decode_timestamp => 0 => 0
yaml.output_canonical => 0 => 0
yaml.output_indent => 2 => 2
yaml.output_width => 80 => 80

Uninstalling the YAML Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/yaml.ini
sudo peclX.Y-sp uninstall yaml

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes