50% OFF!!!

Sunday, November 22, 2015

How to install php imap extension on Centos (or any)

The php package (extension) for IMAP is usually:
php-imap

Sometimes, for example on amazon ec2, when installing PHP ver. 5.5 or 5.6,
In order to install this (or any other) PHP extension,
that not come with the default PHP,
You should installed the one related to your PHP version.

For example,
one of my servers have PHP 5.6 installed on it,
but when running 
 yum install php-imap 
which gives:
Error: php56-imap conflicts with php-imap-5.3.29-1.8.amzn1.x86_64
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: php55-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest 


so instead, check first which version currently installed:
yum list installed | grep php
 which gives:
php56.x86_64                          5.6.14-1.119.amzn1           @amzn-updates
php56-cli.x86_64                      5.6.14-1.119.amzn1           @amzn-updates
php56-common.x86_64                   5.6.14-1.119.amzn1           @amzn-updates
php56-imap.x86_64                     5.6.14-1.119.amzn1           @amzn-updates
php56-jsonc.x86_64                    1.3.6-1.19.amzn1             @amzn-main
php56-mbstring.x86_64                 5.6.14-1.119.amzn1           @amzn-updates
php56-mysqlnd.x86_64                  5.6.14-1.119.amzn1           @amzn-updates
php56-pdo.x86_64                      5.6.14-1.119.amzn1           @amzn-updates
php56-process.x86_64                  5.6.14-1.119.amzn1           @amzn-updates
php56-xml.x86_64                      5.6.14-1.119.amzn1           @amzn-updates 
 

Which means that your PHP version is 5.6 (you can also run php -v)
php -v
 which gives:
PHP 5.6.14 (cli) (built: Oct 16 2015 22:58:32)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

All needed now is to install the correct version.
If you install php55-imap (or any other package) it won't work!
Some have several PHP versions installed.
command:
 
yum install php56-imap

 
don't forget to restart your apache after that.
service httpd restart


and done... :)
Hope it helps.

No comments:

Post a Comment