Posts

Showing posts with the label pdo

Backup MySQL tables in Laravel without third-party libraries

Backup MySQL tables in Laravel without third-party libraries I new to Laravel. I've been trying to create a controller that backups tables in the form of backup_date_.sql format without using any third-party library at all, but I'm getting frustrated. I've searched and I found some code examples. I've tried to use them within my BackupsController, but things are getting more and more difficult. Any help is really appreciated. This is my code, Thanks in advance. <?php public function query($data, $mode = PDO::FETCH_ASSOC) { $pdo = DB::connection()->getPdo(); $stmt = $pdo->query($data); $results = $stmt->fetchAll($mode); // $results = $stmt->fetch($mode); return $results; } public function backup(Request $request) { if ($request->all()) { $output = ''; foreach (request('table') as $table) { $show_table_query = $this->query("SHOW CREATE TABLE " . stripslashes($table) . "...

installed pdo_mysql but could not find driver while connecting

installed pdo_mysql but could not find driver while connecting Connecting to MySQL Database through PDO is showing could not find driver but output of php -i | grep PDO is: PDO PDO supported => enabled PDO drivers => mysql PDO Driver for MySQL => enabled and ouput of php -m contains : PDO pdo_mysql Does your script which shows "could not find driver" also run with the shell version of PHP or through a server? The second option might use another ini file – Nico Haase Jul 1 at 11:02 Nico's probably right. Could be worthwhile to try service php-fpm(7.x)? restart or service apache2 restart . – Cameron Hurd Jul 1 at 12:43 service php-fpm(7.x)? rest...