Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PHP stats library on Ubuntu 16

I'm trying to install the PHP statistics package on my Ubuntu 16.04 LTS server, and I'm stuck.

First off, config stuff:

$ apache2 -v
 Apache/2.4.18 (Ubuntu)

$ php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )

$ pear -V
PEAR Version: 1.10.1

I have successfully added pear using apt-get as well as php-all-dev.

When I try to install the stats package with pecl, I get the following:

$ pecl install stats
pecl/stats is already installed and is the same as the released version 1.0.5

I have also added extension=stats.so to my php.ini and restarted apache.

But when I try to run any of the stats functions, I get the following error:

Fatal error: Uncaught Error: Call to undefined function stats_standard_deviation() in /var/www/html/testing/stats_library.php:14 Stack trace: #0 {main} thrown in /var/www/html/testing/stats_library.php on line 14

What am I missing?

like image 1000
LukeSkywalker Avatar asked Mar 22 '17 20:03

LukeSkywalker


1 Answers

I was able to successfully add the extension by adding the version to the install command like this:

$  pecl install stats-2.0.3

I then added extension=stats.so to my php.ini and restarted apache. Everything works now!

like image 65
LukeSkywalker Avatar answered Sep 22 '22 12:09

LukeSkywalker