Re: Detecting extensions
| From: | Stas Maximov | Date: | Tue, 22 Oct 2002 14:31:46 +0000 |
| Subject: | Re: Detecting extensions | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120916@lists.php.net to get a copy of this message | ||
Thanks to everybody who replied on that. It is working indeed as Adam said,
and there is no fatal error.
Thanks again.
Stas
----- Original Message -----
From: "Adam Voigt" <adam@cryptocomm.com>
To: "Stas Maximov" <maximov@eircom.net>
Cc: "PHP General" <php-general@lists.php.net>
Sent: Tuesday, October 22, 2002 2:20 PM
Subject: Re: [PHP] Detecting extensions
> I just created my own test file, it doesn't do that for me.
> Here's what I got:
>
> <?php
>
> if(!extension_loaded("mssql"))
> {
> echo "doh";
> exit;
> }
>
> mssql_connect("whatever","whatever","whatever")
>
> ?>
>
> The MSSQL functions are not installed on the server,
> and it says "doh" and doesn't give any more warnings.
>
> Adam Voigt
> adam.voigt@cryptocomm.com
>
> On Tue, 2002-10-22 at 09:20, Stas Maximov wrote:
> > Yes, thanks, almost that. My main problem would be to handle that fatal
> > situation in my code.
> > For example, if I would use that function:
> > if (extension_loaded('xslt')) {
> > xslt_create(...);
> > } else {
> > // do something else
> > }
> >
> > The code still won't compile in case when XSLT is not loaded. And same
with
> > includes - it will try to parse includes no matter what:
> > if (extension_loaded('xslt')) {
> > include '/with_xslt.php'; // this one will anyway cause fatal error
if
> > xslt's not loaded
> > } else {
> > include '/without_xslt.php';
> > }
> >
> > Is that right?
> >
> > Stas
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>