Could Not Find Driver in Ubuntu CLI

Note, the PHP version of Apache and Terminal could be different.
Web phpinfo() shows

Loaded Configuration File /etc/php5/apache2/php.ini
PDO drivers | mysql, sqlite

Checking on the terminal

$ php -i |grep php\.ini
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini

Checking for drivers
$ php -i|grep PDO
PDO
PDO support => enabled
PDO drivers =>

As we see we have no drivers

Ubuntu 14.04.3 LTS
sudo apt-get update
sudo apt-get install php5.6-fpm php5.6-mysql
$ php -i|grep PDO
PDO
PDO support => enabled
PDO drivers => mysql
PDO Driver for MySQL => enabled

Installing PHP 7 with Ubuntu
https://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-16-04/

To fix “Could Not Find Driver” error
Ubuntu 16.04.1 LTS
sudo apt-get update;
sudo apt-get install php7.0-fpm php7.0-mysql

Integrate Laravel and Chat Server using WebSocket

Create a file chat-server.php
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use App\Http\Chat;
require 'vendor/autoload.php';
//load laravel framework
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
)
),
9090,
'0.0.0.0' //allow none-localhost ip
);
$server->run();

App\Http\Chat.php is a class that implements Ratchet\MessageComponentInterface. Detailed implementation is found here http://socketo.me/docs/hello-world

To run, open commandline and type $ php chat-server.php If you update the file and related to it make sure to restart the chat server using Ctrl+C then running the command again.

If you encounter “Could not find driver” while using chat-server.php that means there is no enabled mysql driver in php terminal. You can find solutions here http://codes.anthonyaraneta.com/php/could-not-find-driver-in-ubuntu-cli