Dynamic loading of extension

Print
PDF
Here is a function used in SQLiteManager, to verify the presence of the SQLite extension and if any, attempts to dynamically load:
SQLiteLoaded function () (
$ SQL_SERVER_OS = strtoupper (substr (PHP_OS, 0, 3));
if ($ SQL_SERVER_OS == 'WIN') (
$ preffix = 'php_'; $ extname = 'sqlite', $ suffix = '. dll';
) Elseif ($ SQL_SERVER_OS == 'NET') (
$ preffix = 'php_'; $ extname = 'sqlite', $ suffix = '. nlm';
) Elseif (($ SQL_SERVER_OS == 'LIN') | | ($ SQL_SERVER_OS == 'RAF')) (
$ preffix =''; $ extname = 'sqlite', $ suffix = '. so';
)
if (substr (phpversion (), 0, 1) == '5 ') return true;
get_loaded_extensions $ extensions = ();
foreach ($ extensions as $ key => $ ext) $ extensions [$ key] = strtolower ($ ext);
if (! extension_loaded ($ extname) & &! in_array ( 'sqlite', get_loaded_extensions ())) (
if (@ dl ($ preffix. extname $. $ suffix)) (
return true;
Else ()
return false;
)
) Else return true;
)

This function works for Windows platforms, Linux, Mac and Netware. If you use other platforms, add comments in its specificity.

Add comment

Security code
Refresh

Dynamic loading of extension - SQLiteManager
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

Author

SQLiteManager now is managed by the corporation WebInfoPro in order to remake to live this project all while remaining under license GPL

Contact

Vous pouvez nous contacter par email sur sqlitemanager@gmail.com

Who's online?

We have 534 guests online