title: How to add a path to a database import in php mysql
body: <p>First of I searched all around and could not find a valid answer.</p>
  
  <p>I want to import database files into a database using PHP.</p>
  
  <p>The following only works if the <strong>import.php</strong> file resides in the same folder (<strong>temp</strong>) as the database files:</p>
  
  <pre><code>$command = "gunzip --to-stdout $backupfile | mysql -u$database_user -p$database_pass $database";
  </code></pre>
  
  <p>If I place the <strong>import.php</strong> in another location and add a path to the <strong>$backupfile</strong>, it does not work as shown below:</p>
  
  <pre><code>$database_path = '/home/site/public_html/temp/';
  $command = "gunzip --to-stdout $database_path.$backupfile | mysql -u$database_user -p$database_pass $database";
  </code></pre>
  
  <p>What is the correct way to add the path to the database file ($backupfile) so that I can run the PHP script from any location?</p>
  
  <p>Thanks in advance.</p>