Cheat Sheet

Monday, August 22, 2016

Installing PECL on CentOS 7.2 with Php 7.0w (and pecl-stats)

Installing PECL on CentOS 7.2 with Php 7.0w Install php devel
# yum install php-devel
And then, we try
$ pecl version
Nope. Not working. Now lets ask yum, who provides pecl.
# yum provides pecl
This is what I got.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * epel: mirror.smartmedia.net.id
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
 * webtatic: sp.repo.webtatic.com
base/7/x86_64/filelists_db                                                                                                                                       | 6.2 MB  00:00:06
epel/x86_64/filelists_db                                                                                                                                         | 7.3 MB  00:00:12
extras/7/x86_64/filelists_db                                                                                                                                     | 426 kB  00:00:01
updates/7/x86_64/filelists_db                                                                                                                                    | 4.3 MB  00:00:04
webtatic/x86_64/filelists_db                                                                                                                                     |  48 kB  00:00:00
1:php-pear-1.9.4-21.el7.noarch : PHP Extension and Application Repository framework
Repo        : base
Matched from:
Filename    : /usr/bin/pecl



1:php54w-pear-1.10.1-1.w7.noarch : PHP Extension and Application Repository framework
Repo        : webtatic
Matched from:
Filename    : /usr/bin/pecl



1:php55w-pear-1.10.1-1.w7.noarch : PHP Extension and Application Repository framework
Repo        : webtatic
Matched from:
Filename    : /usr/bin/pecl



1:php56w-pear-1.10.1-1.w7.noarch : PHP Extension and Application Repository framework
Repo        : webtatic
Matched from:
Filename    : /usr/bin/pecl



1:php70w-pear-1.10.1-1.w7.noarch : PHP Extension and Application Repository framework
Repo        : webtatic
Matched from:
Filename    : /usr/bin/pecl
Now there it is. Now proceed!!
# yum install php70w-pear
and viola pecl version returns
PEAR Version: 1.10.1
PHP Version: 7.0.9
Zend Engine Version: 3.0.0
Running on: Linux localhost.localdomain 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64
Most of newer version PECL requires GCC 5++. See my other post on how to install GCC 5+ on CentOS (default GCC in CentOS is 4.8). Now we are ready. Lemme try install stats package.
# pecl install stats
Which gives me.
pecl/stats requires PHP (version >= 5.3.0, version <= 5.6.99), installed version is 7.0.9
No valid packages found
install failed
Now that's bummer. Let me try version specific.
# pecl install stats-2.0.3
Which gives us..
downloading stats-2.0.3.tgz ...
Starting to download stats-2.0.3.tgz (112,280 bytes)
.........................done: 112,280 bytes
17 source files, building
.
.
(and some other sexy stuff
.
.
Build process completed successfully
Installing '/usr/lib64/php/modules/stats.so'
install ok: channel://pecl.php.net/stats-2.0.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=stats.so" to php.ini
Next step, put that line on php.ini.
# vi /etc/php.ini
Now, you see that in php.ini in dynamic extensions says:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.

;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;

Let's do it the correct way!
# vi /etc/php.d/pecl-stats.ini
Write this, and :wq
; Enable extension PECL/Stats module
extension=/usr/lib64/php/modules/stats.so
And there you go!

1 comment:

  1. "Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.
    "

    ReplyDelete