In mail.php.internals, Jean-Michel Dault <[EMAIL PROTECTED]> wrote: > Hello all, > > Currently, both Mandrake and RedHat use the following trick: > perl -pi -e "s|^;extension=mysql.so|extension=mysql.so|" /etc/php.ini > > This sucks, because you then need perl to install a PHP extension. > We sure could use sed, but this requires a temporary file, and this > creates some security risks. > > Is there a quick and easy way to do this kind of thing in PHP? Or would > this be something that we could integrate?
I was about to say "Ask the RPM makers" until I saw who was asking :-) How about: php -q -r '$lines=file("/etc/php.ini"); $f=fopen("/etc/php.ini", "w"); \ foreach ($lines as $line) { fwrite($f, preg_replace("/^;extension=mysql.so/",\ "extension=mysql.so", $line)); } fclose($f);' or php-cli -r '..' (as above) ? It'd probably be better to read from the php.ini-dist file or the source in the package and write to php.ini, but the above will work* if it isn't interrupted (which would probably cause other issues with the rpm, so isn't a biggie). * I typed this out without testing it, so it might not work :) I presume perl is no longer a "standard" package installed with either redhat or mandrake thus the question ? Paul. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php