Leonardo Bernardini
Leonardo Bernardini

Reputation: 1116

installing php-imap on amazon ec2 linux 2

I need to install php-imap on amazon ec2 linux 2 instance. All the php stuff is inside amzn2extra-lamp-mariadb10.2-php7.2 but php-imap package is missing. Any advice ?

Thanks

Upvotes: 3

Views: 6398

Answers (3)

MD Nasirul Islam
MD Nasirul Islam

Reputation: 543

For those who are facing the U8T_CANONICAL error and can't being able to install the libc-client-devel on Amazon Linux 2 AMI need to do something extra to resolve the U8T_CANONICAL error.

The main problem is that libc-client-devel isn't available so we need to do it in another way.

I found this link while searching for my problem. The solution that is posted here is solid. The following link that i gave is for those who are not being able to install the libc-client-devel will be benifited from the link.

Or you could just copy paste the commands i'm giving below.

1 - sudo yum groupinstall "Development Tools"

2 - sudo amazon-linux-extras install epel

3 - yum install epel-release

4 - sudo yum install libc-client-devel uw-imap-static openssl-devel

5 - sudo ln -s /usr/lib64/libc-client.a /usr/lib

The rest can be followed from respondent. Again thanks to the person who answered.

Upvotes: 1

I installed it like this.

I downloaded the php source code of the currently installed version in my Amazon Linux 2

wget http://php.net/get/php-7.2.8.tar.bz2/from/a/mirror

Unpacked it and went into php-7.2.8/ext/imap/

Compiled extension:

phpize
./configure

I got some errors.

Some U8T_CANONICAL stuff so

sudo yum install libc-client-devel

Then libc-client.a not found so created a symlink for it:

cd /usr/lib
sudo ln -s /usr/lib64/libc-client.a

some other imap library error so:

sudo yum install uw-imap-static

I got some other errors so the working configure line was:

./configure --with-kerberos --with-imap-ssl
make

SUCCESS!

cd php-7.2.8/ext/imap/modules
sudo cp imap.so /usr/lib64/php/modules/

Created an ini file to load it:

sudo vi /etc/php.d/30-imap.ini

added to the file this content:

extension=imap

restarted php service (you might need to restart httpd depending on your php installation):

sudo systemctl restart php-fpm

PHPinfo now contains: imap IMAP c-Client Version 2007f SSL Support enabled Kerberos Support enabled

Upvotes: 8

eXe
eXe

Reputation: 11

Same problem here.

I came from debian/ubuntu and i miss a lot of php packages on aws linux2. I know it's still a candidate and not a final LTS release. Only worked for a month with this distro and saw a lot of changes and updates. Some php dependencies can be solved with pear or pecl, but I couldn't get nothing working on php-imap.

php-imap depends on libc-client (maybe that's a problem?)

Here is my solution.

  • Search for the libc-client rpm that correspond to your version and install manually.
  • Search for the rpm that corresponds to your php installed version. In my case it was 7.2.5**-2** about 2 weeks ago. (today is 7.2.5**-3** ) and isntall manually

CODE

wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64//php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm -P /tmp
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libc-client-2007f-16.el7.x86_64.rpm -P /tmp

rpm -i /tmp/libc-client-2007f-16.el7.x86_64.rpm
rpm -i /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm

If it fails because Failed dependencies:

rpm -ivh /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm --nodeps

I dont like this solution, but can't find for now any other solution more stable and easy. It will be a pain with updates....

Upvotes: -1

Related Questions