Re: [PHP-DEV] Configuration in the php.ini file
Hi, On Fri, 2009-10-09 at 15:21 +0200, Samuel ROZE wrote: > I wanted to change a parameter in my PDO class, with the fourth > PDO::_construct arg. But, I've many projects, which uses PDO, with one > "new PDO" per project. The problem is that I have to change the source > of every projects... > > Why isn't there an PDO section in the php.ini file ? For instance: > > pdo.is_persistent = 1 > pdo.fetch_notices = 1 Using these means two places have to be changed and monitored - the application-specify configuration holding DSN, username and password and the php.ini additionally. Some applications might have trouble if there expectations about the environment isn't correct. The more ini settings you have the more trouble ... these won'T be as troublesome as magic_quotes but could still lead to unexpected behavior if the developer doesn't expect them in some cases. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
And I still have to modifiy my source. ;-) In fact I'm using a personnaly Database class using PDO for add execution times and array/string transformations. Actually, I just wanted to know why there isn't any pdo propreties in the php.ini file. Pierre replied. Thanks ! Samuel. 2009/10/9 Olivier B. : > Hi > >> There isn't because nobody developed that or because it is contradicted ? > > here we extends the PDO class to configure it like we want. > For example : > class ourPDO > { > public function __construct( $dsn, $user = NULL, $password = NULL, > $options = NULL ) > { > $defaultOptions = array( > PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, > PDO::ATTR_TIMEOUT => 5, > PDO::ATTR_CASE => PDO::CASE_NATURAL, > PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, > ); > > if( is_array($options) ) > $defaultOptions = $options + $defaultOptions; > > parent::__construct($dsn, $user, $password, $defaultOptions); > } > } > > and in code, we use $db = new ourPDO( ... ); > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
Hi There isn't because nobody developed that or because it is contradicted ? here we extends the PDO class to configure it like we want. For example : class ourPDO { public function __construct( $dsn, $user = NULL, $password = NULL, $options = NULL ) { $defaultOptions = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::ATTR_TIMEOUT => 5, PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ); if( is_array($options) ) $defaultOptions = $options + $defaultOptions; parent::__construct($dsn, $user, $password, $defaultOptions); } } and in code, we use $db = new ourPDO( ... ); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
It isn't. :-) Thanks. 2009/10/9 Pierre Joye : > hi, > > The general consensus is to do not add new ini settings unless it is > absolutely necessary. It is not the case for your example as it is > cleary an application configuration problem (user land configuration). > > Cheers, > -- > Pierre > > On Fri, Oct 9, 2009 at 3:21 PM, Samuel ROZE wrote: >> Hi, >> >> I wanted to change a parameter in my PDO class, with the fourth >> PDO::_construct arg. But, I've many projects, which uses PDO, with one >> "new PDO" per project. The problem is that I have to change the source >> of every projects... >> >> Why isn't there an PDO section in the php.ini file ? For instance: >> >> pdo.is_persistent = 1 >> pdo.fetch_notices = 1 >> >> ...and more ! >> >> There isn't because nobody developed that or because it is contradicted ? >> >> Samuel. >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Pierre > > http://blog.thepimp.net | http://www.libgd.org > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
hi, The general consensus is to do not add new ini settings unless it is absolutely necessary. It is not the case for your example as it is cleary an application configuration problem (user land configuration). Cheers, -- Pierre On Fri, Oct 9, 2009 at 3:21 PM, Samuel ROZE wrote: > Hi, > > I wanted to change a parameter in my PDO class, with the fourth > PDO::_construct arg. But, I've many projects, which uses PDO, with one > "new PDO" per project. The problem is that I have to change the source > of every projects... > > Why isn't there an PDO section in the php.ini file ? For instance: > > pdo.is_persistent = 1 > pdo.fetch_notices = 1 > > ...and more ! > > There isn't because nobody developed that or because it is contradicted ? > > Samuel. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Configuration in the php.ini file
Hi, I wanted to change a parameter in my PDO class, with the fourth PDO::_construct arg. But, I've many projects, which uses PDO, with one "new PDO" per project. The problem is that I have to change the source of every projects... Why isn't there an PDO section in the php.ini file ? For instance: pdo.is_persistent = 1 pdo.fetch_notices = 1 ...and more ! There isn't because nobody developed that or because it is contradicted ? Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php