How to Replace Character into a File with PHP
Posted: Fri May 19, 2006 9:35 am
Hi! I'm working on Linux station. I would like to replace variable value into a Perl Script. I know this shell command:
perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName
And I've tried to launch it in my PHP script like this:
system("perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName");
Or
exec("perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName");
the variables I must replace the values are in a Perl Script which I Run later :
exec(perl FileName >file.log); //this one works very good
how can I procede?
perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName
And I've tried to launch it in my PHP script like this:
system("perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName");
Or
exec("perl -pi -e \'s/FirstWordToChange/ByThisOne/g\' FileName");
the variables I must replace the values are in a Perl Script which I Run later :
exec(perl FileName >file.log); //this one works very good
how can I procede?