imap_open():无法在linux服务器上打开流

时间:2018-05-27 10:50:27

标签: php linux xampp imap

我的代码在使用XAMPP的Windows笔记本电脑上运行时工作正常,但是当我尝试在linux机器上运行相同的代码时,它给出了错误。 我的代码:

<?php
$connect_to = '{imap.gmail.com:993/imap/ssl}INBOX';
$user = 'my gmail address';
$password = 'my gmail password';

$connection = imap_open($connect_to, $user, $password)
  or die("Can't connect to '$connect_to': " . imap_last_error());

imap_close($connection);
?>

我收到错误:

PHP Warning:imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/re-work/test_imap.php on line 30
Array
(
    [type] => 2
    [message] => imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX
    [file] => /home/re-work/test_imap.php
    [line] => 30
)
PHP Warning:  imap_num_msg() expects parameter 1 to be resource, boolean given in /home/re-work/test_imap.php on line 39
PHP Warning:  imap_search() expects parameter 1 to be resource, boolean given in /home/re-work/test_imap.php on line 42
0</br>PHP Notice:  Unknown: Retrying PLAIN authentication after [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=1) in Unknown on line 0
PHP Notice:  Unknown: Retrying PLAIN authentication after [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=1) in Unknown on line 0
PHP Notice:  Unknown: Can not authenticate to IMAP server: [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=2) in Unknown on line 0

请帮助我遗失的地方和地点?

0 个答案:

没有答案