installing imap on ubuntu for php7.1

Viewed 35414

How can one install imap for php in ubuntu for php7.1 preferably in the terminal.

There's some info on this on the php.net manual but it's a bit dated.

It talks about the c-client library and restarting apache afterwards etc

I'm still pretty new with linux

3 Answers

You can install IMAP by following ways.

Step1: sudo apt-get install php7.1-imap

Step2: sudo phpenmod imap

Step3: php -m. Find out imap module

Step4: Run below command to confirm imap is install. 1. php -i | grep -i imap 2. dpkg -l | grep php7.1-imap

Step5: check phpinfo()enter image description here

check imap is showing or not.

After enabling a module, you have to restart your pc. If a module is still not displayed in phpinfo(), please check on the next day.

This is how you can install regardless of php version, on any Debian Linux distro (Ubuntu is a Debian distro). Go to your terminal and type

sudo apt install php-imap

Let apt run and install imap.

sudo phpenmod imap

This will enable imap mod in php. You will need to restart your webserver for the change to take effect eg...

sudo systemctl restart apache2

for apache webserver.

to check that this is working, create a php file in your webserver's folder, /var/www/html for Apache, call it whateveryouwant.php and then edit it, and type

<?php

phpinfo();

?>

inside it, save file, and then open it in localhost. You'll get an info panel which you can search for imap. See highlighted bit in screenshot. That's what you will see if you have installed imap successfully phpinfo

Related