I have a script that is duplicating a file, but after I duplicate that file, I need a script to dynamically change certain string values inside that file.
Through searching around I found that file_get_contents and str_replace work best for this, but for some reason the script I have does not work.
This is what I have: (note: $wikiname is the name of the new wiki being created
$template = file_get_contents("/var/www/wiki/". $wikiname ."/LocalSettings.php");
$snReplace = str_replace("templatewiki", $wikiname, $template);
$mnReplace = str_replace("Templatewiki", $wikiname, $template);
$spReplace = str_replace("/iadmin/wikifresh", "/wiki/".$wikiname, $template);
$wgDBname = str_replace("template_wiki", $wikiname, $template);
Im searching for the exact string and trying to replace that string with the wiki name. But for some reason, this doesn't work at all.
Is there an obvious issue I'm missing?
Thanks
str_replace()works and read about its return value.