title: Run sql file from php code to insert data in a different Server
body: <p>I want to transfer data from test server database to live server database. The data is in the form of a .sql file. So using php on stage server can I transfer the data using shell_exec();</p>
  
  <pre><code>$command = "mysql -u{$vals['db_user']} -p{$vals['db_pass']} "
   . "-h {$vals['db_host']} -D {$vals['db_name']} &lt; {$script_path}";
  
  $output = shell_exec($command . '/shellexec.sql');
  </code></pre>
  
  <p>The above code is not working. is there any other way?</p>