PHP Imap is a open source library to connect mailbox. It enables to fetch emails from your server. Its a necessary extension if you want web applications to handle your incoming mails.
If you are using Centos Web Panel in your VPS or Dedicated server you need install PHP Imap to properly use your mail server. You will notice that this feature wont show in PHP.ini or in PHP Version Switcher if not installed from SSH.
Step 1 : Login to putty or any SSH client using your root credentials and run the following command
sudo yum install php-imap
The output will be like this
[root@server ~]# sudo yum install php-imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 18 kB 00:00
* base: mirror.shastacoe.net
* epel: sjc.edge.kernel.org
* extras: repos-lax.psychz.net
* updates: mirror.hostduplex.com
base | 3.6 kB 00:00
cwp | 2.9 kB 00:00
epel | 4.7 kB 00:00
extras | 2.9 kB 00:00
mariadb | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/2): epel/x86_64/updateinfo | 1.0 MB 00:00
(2/2): epel/x86_64/primary_db | 6.8 MB 00:03
Resolving Dependencies
--> Running transaction check
---> Package php-imap.x86_64 0:5.4.16-9.el7 will be installed
--> Processing Dependency: php(zend-abi) = 20100525-64 for package: php-imap-5.4.16-9.el7.x86_64
--> Processing Dependency: php(api) = 20100412-64 for package: php-imap-5.4.16-9.el7.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-48.el7.x86_64
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================================
Installing:
php-imap x86_64 5.4.16-9.el7 epel 38 k
Installing for dependencies:
libzip x86_64 0.10.1-8.el7 base 48 k
php-common x86_64 5.4.16-48.el7 base 565 k
Transaction Summary
======================================================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 652 k
Installed size: 4.0 M
Is this ok [y/d/N]:
Press y and then enter to proceed with the installation. If there is no issue you see a success message that PHP Imap Installation is Complete.
After this you should restart the server with below command
reboot
You will be able to use the fuctions on PHP Imap after reboot.