IMAP enabled, but functions undefined?

做~自己de王妃 提交于 2020-01-16 06:25:46

问题


One of our email parsing scripts is having a problem using imap functions:

Fatal error: Call to undefined function imap_open()

IMAP is definitely enabled, it was compiled with php and shows up in the phpinfo() and when doing get_loaded_extensions() or extension_loaded("imap") Is there any reason why these functions may not be accessible?

IMAP version is 2007e and PHP is 5.3.

Edit 1: This is running on a mac server (OSX 10.5.7) the script using the imap function is in /var/***/ I tried putting a test file in /Library/WebServer/Document (the web root) using imap_open with the exact same details and it seems to work.

The way it is setup worked before a PHP update - is there any reason for it to stop working? I know I could move the email script into the webserver documents dir but I would also like to know why it would stop working the way it was before - could it be the way php is configured?


回答1:


With

echo get_cfg_var('cfg_file_path');

you can find out which php.ini has been used by this instance of php. You will probably see that the php apache-module (or is it php-cgi?) and the php cli version (used by your cronjob) are using different .ini files.
Depending on how you've installed php (and how this version of php was compiled) the apache module might also parse additional .ini files that your cli version does not. To check if this is the case run

<?php phpinfo(); ?>

in your webserver and look for an entry "additional .ini files parsed".
In any case you have to take care that the configuration used by the cli version includes the extension=php_imap... directive.



来源:https://stackoverflow.com/questions/1096916/imap-enabled-but-functions-undefined

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!