Re: Detecting extensions

From: Date: Tue, 22 Oct 2002 13:20:56 +0000
Subject: Re: Detecting extensions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-120901@lists.php.net to get a copy of this message
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 >

« previous php.general (#120901) next »