Re: How to check for a php-extension?
| From: | Jim Winstead | Date: | Thu, 04 Apr 2002 19:47:15 +0000 |
| Subject: | Re: How to check for a php-extension? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91588@lists.php.net to get a copy of this message | ||
Duncan <php-general@ring-wraith.com> wrote:
> i wrote a script, which uses the IMAP-extension. But if s.o. uses it
> on a machine, which doesn't support IMAP functions, i get an error
> message. How can i prevent this error:
>
> Fatal error: Call to undefined function: imap_open() in
> /home/test/public_html/test/imap_test.php on line 8
>
> and replace it with s.th. like: "This function doesn't work, due to
> missing IMAP extension".
>
> I already tried some stuff, but the problem is, that php exits the
> script as soon as it hits the first IMAP related function.
http://www.php.net/manual/en/function.extension-loaded.php
if (!extension_loaded("imap")) {
die("the imap extension is not loaded.");
}
jim