May 3

php的extension 参数配置思考 不指定

admin , 00:14 , 数据库 » 数据库(SQLite) , 评论(0) , 引用(0) , 阅读(3898) , Via 本站原创 | |

一直在找一直方法,不去改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') { 
  } else { 

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.
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
echo "<br>";
echo ini_get('mysql.connect_timeout'); // output 100

Tags: ,