title: PHP file_get_contents(): No Such file or directory
body: <p>I have a class that create databases and tables in it automatically(if no database exist). The class is working fine whenever I run it directly in my localhost but if I call it from another file it is returning an error. The database creation class</p>
  
  <pre><code>class DbSetup
  {
  
  public static function setup_db()
  {
  try {
    $connect_server = new PDO("mysql:host=localhost", 'root', 'rammanoj888116' );
    $create_default = $connect_server-&gt;prepare("CREATE DATABASE manoj");
    $create_default-&gt;execute();
    $connect_server = new PDO("mysql:host=localhost;dbname=manoj", 'root','rammanoj888116' );
    $connect_server-&gt;setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
    $file = file_get_contents( 'database.sql' );
    $create_tables = $connect_server-&gt;prepare($file);
    $create_tables-&gt;execute();
    $create_tables-&gt;closeCursor();
    $file_2 = file_get_contents( 'exam_tables.sql' );
    $create_tables_2 = $connect_server-&gt;prepare($file_2);
    $create_tables_2-&gt;execute();
    echo "1";
  }
  catch(Exception $e) {
    echo "0";
    echo $e;
  }
  }
  }
  </code></pre>
  
  <p>I am calling this function in the following manner</p>
  
  <pre><code>public function create_db() {
    $rv = DbSetup::setup_db();
    return $rv;
  }
  </code></pre>
  
  <p>This is returning the folliwing error</p>
  
  <blockquote>
    <p>file_get_contents(database.sql): failed to open stream: No such file or >directory in <b>/var/www/html/portal/dbsetup/DbSetup.php</b> on line ><b>14</b><br />
    0PDOException: SQLSTATE[42000]: Syntax error or access violation: 1065</p>
  </blockquote>