I am creating a CMS and have created a self installer that creates the tables in the database.
I am using this php code which everything works great on wamp but the script quites after 10 files on the server.
if (!$db = new PDO('mysql:host='.$dbhost.'; dbname='.$dbname, $dbuser, $dbpass)){$msg = 'e|Could Not Connect.';}
elseif ($db = new PDO('mysql:host='.$dbhost.'; dbname='.$dbname, $dbuser, $dbpass)){
$sql = '';
foreach(glob('sql/*') as $file) {$sql .= file_get_contents($file);}
$db->exec($sql);
}
There are a total of 48 txt files in sql/ which look like this:
--
-- Table structure for table `block_grids`
--
CREATE TABLE IF NOT EXISTS `block_grids` (
`block_grid_id` int(12) NOT NULL AUTO_INCREMENT,
`block_grid_name` varchar(25) NOT NULL,
`row_items_small` tinyint(2) NOT NULL,
`row_items_medium` tinyint(2) NOT NULL,
`row_items_large` tinyint(2) NOT NULL,
`equalize_block_grid` tinyint(1) NOT NULL,
PRIMARY KEY (`block_grid_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
The server is set to 200mMiBs for the upload and the total of the 10 files executed is only 161KiBs. Not quite sure where to go with it...
The code above concatenates all the files together which works fine on wamp. I tried running each file individully with this code but it quite after only 4 on every attempt:
if (!$db = new PDO('mysql:host='.$dbhost.'; dbname='.$dbname, $dbuser, $dbpass)){$msg = 'e|Could Not Connect.';}
elseif ($db = new PDO('mysql:host='.$dbhost.'; dbname='.$dbname, $dbuser, $dbpass)){
$sql = '';
foreach(glob('sql/*') as $file) {
$sql = file_get_contents($file);
$db->exec($sql);
}
}