tags:

views:

210

answers:

1

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 the 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  A: 

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.

VolkerK
I checked the crontab after your last comment and she .sh script it was running specified the wrong php instance - I amended it and it works. Spot on answer - thanks.
Tjkoopa