Last Updated on December 7, 2020 by Vikash Ekka
How to enable php imap extension on Amazon Linux 2 |
In this tutorial, we will enable or fix php imap extension on Amazon Linux AMI 2. We will need the tools to compile the module, if you don’t have them installed you can do it as follows:
sudo yum groupinstall “Development Tools”
To install the necessary dependencies we must activate the EPEL repository, if you do not have it activated do the following:
sudo amazon-linux-extras install epel
yum install epel-release
Now we install the dependencies:
sudo yum install libc-client-devel uw-imap-static openssl-devel
sudo ln -s /usr/lib64/libc-client.a /usr/lib
Then we will download the source code of the version of PHP that you are using from https://www.php.net/downloads.php
cd ~
wget https://www.php.net/distributions/php-7.x.x.tar.gz
cd php-7.x.x/ext/imap
phpize
./configure –with-berberos –with-imap-ssl
make
cd php-7.x.x/ext/imap/modules
sudo cp imap.so /usr/lib64/php/modules/
And we create an ini file to load it
sudo nano /etc/php.d/30-imap.in
Add the following content to the file
extension=imap
We restart the PHP service (you may need to restart httpd depending on your php installation)
sudo systemctl restart php-fpm
OR
sudo systemctl restart httpd
To verify if the module was correctly loaded we execute
php -m | grep imap
[ec2-user@vetechno ~]$ php -m | grep imap
imap
[ec2-user@vetechno ~]$
Conclusion:-
Also Read :- How to install MySQL 5.5 on Ubuntu 20.04 LTS
Also Read :- How To Install Linux, Apache, MySQL, PHP (LAMP) on Ubuntu 20.04 LTS
Also Read :- How to Uninstall PHP, Apache and MySQL on Ubuntu 20.04 LTS
thanks! works perfect!
little typo must be — with kerberos instead of berberos. Also the .gz file needs to be extracted .tar -xf php-7.x.x.tar.gz