I had the same problem (as I know, the SOURCE command is only implemented in the command line tool) and running the shell command is not possible. I found the following: if the sql command is SOURCE , I truncate the parameter (file name) and try to process it. (I use my own mysql library, db_Exec() has the same effect as mysql_query() .)
function db_Exec_plus($query) { $tmp = explode(" ", trim($query), 2); if(isset($tmp[0]) && strtoupper(trim($tmp[0]))=='SOURCE') { if (isset($tmp[1]) && file_exists($tmp[1])) { $result_array = array(); $fp = fopen($tmp[1], "r"); while (!feof($fp)) { $cmd = trim(fgets($fp)); $result_array[] = db_Exec($cmd); } fclose($fp); return $result_array; } else { return false; } } else { return db_Exec($query); } }
source share