PHP IMAP Extension – Install / Enable IMAP In PHP

install or enable IMAP extension in php

by default, the IMAP for PHP is deactivated. First, you need to check whether PHP IMAP is installed or not. lets check with phpinfo() function.

Check PHP IMAP Is Install.

1) Create a new file in your root directory called “whatever.php” and put below small code on this file.

Note: it is not a good practice to name the file “phpinfo.php”, because some attackers search for files with that name on your servers. so, please keep it in your mind.
2) Now, run this file from your favorite browser.
3) You can check the same as snap below.

phpinfo()

If it is not installed don’t worry follow the below steps.

Enable IMAP in XAMPP

1) go to the file \xampp\php\php.ini and open php.ini in your editor.
2) find ;extension=php_imap.dll
3) Remove semicolon from ;extension=php_imap.dll.
4) Now, now it should looks like extension=php_imap.dll
5) Save your file and restart the xampp server.

Enable IMAP in Linux

In Linux, you need to install the PHP IMAP module with the following steps:
1) Open your terminal.
2) Run below command.

sudo apt-get install php5-imap

3) To enable IMAP you can run below command.

sudo php5enmod imap

4) Restart apache server with the following command.

service apache2 restart


Install IMAP on Ubuntu for PHP 7.1

1) Run below command.

sudo apt install php7.1-imap

2) don’t forget to restart apache.

sudo systemctl restart apache2