Good Josue, the problem is the concatenation of your chains with PHP variables. That is, to concatenate variables in PHP the point is used.
To achieve this correctly you must open and close the quotation marks correctly at all times.
One note to keep in mind is that in PHP the use of double quotes allows the use of PHP variables inside without having to open and close the quotes and use the period.
In your case you start using single quotes, which you need to close and open again to concatenate. An example of what you have done is:
$miVariable = '<?php $servername = ".'$servername'."; ?>';
This would be wrong, being the right way:
$miVariable = '<?php $servername = "'.$servername.'"; ?>';
Changing the place of the points can be concatenated correctly.
UPDATE
Josue, when you use quotes again in the include, you close the concatenated string again, exactly here:
include ('../configs/variables.php');
include ('../configs/template.php');
Change this part for this:
include ("../configs/variables.php");
include ("../configs/template.php");
I recommend using a code editor with syntax highlighting to indicate these errors visually and you can correct them at the same time.
An example of what happened to you is:
<?php
$miEdad = 10 ;
$miFrase = "Tengo ";
$finalComillasDobles = $miFrase." $miEdad años";
echo $finalComillasDobles;
$finalComillasSimples = $miFrase.' '.$miEdad.' años';
echo $finalComillasSimples ;
$finalComplejo ="Hola amigo. '$miFrase $miEdad años'.".'Hasta luego ';
echo $finalComplejo ;
?>
This example would give an output of:
"Tengo 10 años"
"Tengo 10 años"
"Hola amigo. 'Tengo 10 años'.Hasta luego "
In short, the use of single and double quotes is indifferent with the only difference that doubles allow us to use our variables without concatenating, if we use both we only have to know when to close and open each one.