Re: Using PHP for search and replace
| From: | Jean-Michel Dault | Date: | Mon, 06 Jan 2003 10:38:28 +0000 |
| Subject: | Re: Using PHP for search and replace | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93177@lists.php.net to get a copy of this message | ||
Le lun 06/01/2003 à 06:35, Paul Gregg a écrit :
> > perl -pi -e "s|^;extension=mysql.so|extension=mysql.so|" /etc/php.ini
> > Is there a quick and easy way to do this kind of thing in PHP? Or would
> I was about to say "Ask the RPM makers" until I saw who was asking :-)
Everyone's doing that.. RedHat, SuSe, PLD, Mandrake... so obviously no
RPM guy has ever tried something else ;-)
> 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);'
I'll try that, thanks!
> I presume perl is no longer a "standard" package installed with either
> redhat or mandrake thus the question ?
No, it's just that it's pretty weird to have a Prereq: perl in a PHP
package. Imagine the irony, you install the best scripting language
(PHP) and you need its competitor (Perl) to be able to use install it
;-)
Jean-Michel