I want to generate connector.php
file during installation like this
$file = "connector.php";
$fp = fopen($file,"wb");
$content = "<?php $con=mysqli_connect('";
$content += $host;
$content += "', '";
$content += $user;
$content += "', '";
$content += $password;
$content += "', 'blog'); if (mysqli_connect_errno()) { echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); }?>";
fwrite($fp,$content);
fclose($fp);
but when I try this code, I just generate empty file (when I try some random text, it works fine), so I think, the problem is, that PHP trying to interpret everything between <?php
and ?>
. How can I make this code work, and make PHP not interpret code between php tags.