title: Best Way to create configuration file(config.php) php
body: <p>I am creating a  database configuration file for my project, but I am not sure if my config.php is secure.</p>
  
  <p>How would I modify this script for a secure connection? </p>
  
  <p><strong>config.php</strong></p>
  
  <pre><code>&lt;?php
  $username="root";
  $password="";
  $host="localhost";
  $database="practise";
  ?&gt;
  </code></pre>
  
  <p><strong>Index.php</strong></p>
  
  <pre><code>&lt;?php
  include 'config.php';
  $con=mysql_connect("$host","$username","$password") or die("Server Error");
  mysql_select_db("$database") or die("Database error");
  
  if($con==true)
  {
      echo "Success";
  }
  else
  {
      mysql_close($con);
  }
  ?&gt;
  </code></pre>