php的extension 参数配置思考

一直在找一直方法,不去改php.ini 的配置,而是通过动态修改才是来配置,来支持sqlite3.
但是还是不行,因为配置完需要重启。下面为收集的相关比较:

I do not have access to /etc/php.ini and cannot uncomment the lines required to activate php extensions I require.

extensions can only be disabled by editing php.ini 
or use dl() function,such as
***
if (!extension_loaded('php_pdo')) {  
 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { 
  dl('php_pdo.dll');  
  } else { 
  dl('php_pdo.so'); 
  }
 }

***
but :
Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=php_sqlite.dll

Only if the extension has an attribute for that.
Like:
extension.bla_enabled = 0/1 in php.ini

Then you can set it in runtime by:
ini_set("extension.bla_enabled", "0");

ini_set to update settings of php.ini file
We can't change all the configured settings of php.ini file. PHP will permit to change some data by using ini_set function. We will verify after changing the configured data by using ini_get function. Here is the code. Please note the outputs shown here will change based on your server settings when you try.
echo ini_get('mysql.connect_timeout'); // OUTPUT 60
ini_set('mysql.connect_timeout',100);
echo "<br>";
echo ini_get('mysql.connect_timeout'); // output 100

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2024年11月    »
123
45678910
11121314151617
18192021222324
252627282930
搜索
标签列表
网站分类
最新留言
    文章归档
    友情链接

    Powered By Z-BlogPHP 1.7.3

    Copyright Your WebSite.Some Rights Reserved.闽ICP备11018667号-2