I want those variables to be filled with their values, but in config.php file its writing the variable name itself, I want like $host convert to 'localhost' with single quotes in the config.php file.
$handle = fopen('../config.php', 'w');
fwrite($handle, '
<?php
$connection = mysql_connect({$host}, {$user}, {$pass});
?>
');
fclose($handle);