Answer the question
In order to leave comments, you need to log in
How to install imap ubuntu php 7.2?
I'm trying to see mail on gmail, they advised such a script
$imap = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', $username, $password);
$emails = imap_search($imap, 'ALL');
if($emails) { echo count($emails); }
imap_close($inbox);
PHP Fatal error: Uncaught Error: Call to undefined function imap_open()
sudo apt install php-imap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libc-client2007e mlock php7.3-imap
Suggested packages:
uw-mailutils
The following NEW packages will be installed:
libc-client2007e mlock php-imap php7.3-imap
0 upgraded, 4 newly installed, 0 to remove and 30 not upgraded.
Need to get 28.5 kB/622 kB of archives.
After this operation, 1,618 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 https://packages.sury.org/php stretch/main amd64 php7.3-imap amd64 7.3.5-1+0~20190503093827.38+stretch~1.gbp60a41b
404 Not Found
E: Failed to fetch https://packages.sury.org/php/pool/main/p/php7.3/php7.3-imap_7.3.5-1+0~20190503093827.38+stretch~1.gbp60a41b_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Answer the question
In order to leave comments, you need to log in
Try to do so.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-imap
sudo service apache2 restart
$imap = imap_open('{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX', 'login', 'password');
$emails = imap_search($imap, 'ALL');
if($emails){
echo count($emails);
}
imap_close($imap);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question