Jean-Michel Dault <[EMAIL PROTECTED]> wrote: > 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? > > And I know there's a new solution with the new config-file-scan-dir, but > my question is a general search-and-replace solution.
echo 'w php.ini.bak ,s/^; *extension=mysql.so/extension=mysql.so/ wq ' | ed php.ini >/dev/null should do what you want. Regards... Michael -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php