title: Hide Database Login Information in PHP Code
body: <p>im a total beginner in web programming. Im trying to create a simple website that is reading data from a SQL Database. At first i just wrote my database password and login directly into the php code:</p>
  
  <pre><code>&lt;?php
  $username = "login";
  $password = "pw";
  mysql_connect("server", $username, $password);
  ...
  ?&gt;
  </code></pre>
  
  <p>This obviously isn't a very good idea! So what is a (much) more "secure" way to do this? I read about putting the php code into a seperate file, meaning not into the main php document of the website, and then restricting the access to that file. Maybe by a .htaccess file. Is this the way to go?</p>