‹ Articles

How to Install the PHP Stats Extension

In the examples shown, replace "X.Y" with your app's PHP version (for example, "5.6" or "7.0"). To install this extension for multiple PHP versions, repeat the installation for each PHP version.

The PHP stats extension provides functions for statistical computations.

Installing the Stats Extension on PHP 7.0, 7.1, or 7.2

To install this extension on PHP 7.X, SSH into your server as root and run the following commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl7.X-sp install stats-2.0.3
sudo bash -c "echo extension=stats.so > /etc/php7.X-sp/conf.d/stats.ini"
sudo service php7.X-fpm-sp restart

Installing the Stats Extension on PHP 5.4, 5.5, or 5.6

To install this extension on PHP 5.X, SSH into your server as root and run the following commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl5.X-sp install stats-1.0.5
sudo bash -c "echo extension=stats.so > /etc/php5.X-sp/conf.d/stats.ini"
sudo service php5.X-fpm-sp restart

Verify the Installation

You can verify the stats extension is installed by running this command:

phpX.Y-sp -i | grep stats

You should see the following output:

/etc/phpX.Y-sp/conf.d/stats.ini,
stats

Uninstalling the Stats Extension

To uninstall this extension, as root run the commands:

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

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart

Last updated: February 26, 2018

Still Have Questions?

Don't hesitate to contact us if you can't find the answers to your questions.