I have created a CMS. When installing the CMS, I must install its database. I use PHP multi_query()
to istall the database without opening phpMyAdmin. When the SQL file is as small as 624KB, the database is installed successfully. However, when the SQL file is as large as 6.32MB or more, the database does not install. Here is the code I use to install the database via PHP
$sParamSqlFile = 'database.sql';
if(file_exists($sParamSqlFile)){
$fSql = file_get_contents($sParamSqlFile);
/* execute multi query */
if ($oDbConn->multi_query($fSql)){
do {
/* store first result set */
if ($oResult = $oDbConn->store_result()) {
while ($aRow = $oResult->fetch_row()) {
//
}
$oResult->free();
};
/* print divider */
if ($oDbConn->more_results()){
//
}
} while ($oDbConn->next_result());
}
else{
return 'false';
}
/* close connection */
$oDbConn->close();
return 'true';
}
return $sParamSqlFile . ' does not exist';
Edit: I have encounted this error while trying to install the database "Warning: mysqli::multi_query(): Error while reading SET_OPTION's response packet. PID=8660"
Could you help with a solution so that I could install the database when the SQL file is large?