【发布时间】:2015-08-31 19:47:18
【问题描述】:
我有一个带有 imap 函数的 php 脚本。当我从浏览器调用 php 文件时一切都很好,但是当它使用 cronjob 运行时出现以下错误:
X-Powered-By: PHP/5.3.27
Set-Cookie: bgm=31dc5ff02b6a3d1614a9dd1c39321fd0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html
<br />
<b>Warning</b>: imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {"hostname":993/imap/notls/ssl} in <b>/"path"/cron.php</b> on line <b>173</b><br />
<br/><br/><span style='color:red'></span><pre>Certificate failure for "hostname": unable to get local issuer certificate: /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA</pre><br/><br/><br />
操作系统:CentOS 5.9 cronjob 是使用 Cpanel 创建的:/usr/bin/php file.php。 imap_last_error() 给出以下错误:“主机名”的证书失败:无法获得本地颁发者证书: 但是当我从任何浏览器调用 cron.php 时,证书失败并没有出现,一切正常。
【问题讨论】:
-
似乎查看 file.php 并查看命令是什么,因为它在调用时期待不同的东西。错误要求建立连接,但没有连接。
-
所以这个问题的主题不应该是“php imap functions with cronjob”,而是“How to configure a set of supported CAs with PHP's IMAP functions”。