Write to php file with php script or create new file, it is possible?

Hello,
I’ve a config.php file that contains the following:
$dbhost = “localhost”;
$dbuname = “root”;
$dbpass = “”;
$dbname = “test”;
$prefix = “test”;
$user_prefix = “test”;
$dbtype = “MySQL”;

And I’ve a script that gives these variables right values/texts. The problem is that I can’t figure out how to insert the new values into the config.php file without having to open it manually and insert the text myself (I’m working on a installation script). Is it possible to insert the right values into the config.php file without editing it manually?

So for example the $dbname = “test”; is changed to the value I writed in the installation script like for example $dbname = “right”;.

Or is it possible to just create a new config file with the variables from the script? (the script creates a new config file with the things I want)?

Yes we can

but remember to give 777 permission to config.php

OR

 

 

Comments

comments