php returns integers as string on server

I have run into this problem for several times. So I'm writing this down right now (mainly for myself).

I'm developing php applications with laravel on my homestead vagrant box. When serializing a model to json on my local environment, all php numeric values are converted to json numeric values, but on my server (with same php version installed) it converts the php numeric value into json strings. Responsible for that is the PDO. It seems that MySQL client library can't handle the conversion.

Solution: install MySQL native driver for php

The MySQL native driver for PHP (mysqlnd) is a drop-in replacement for the MySQL Client Library (libmysql) for the PHP script language.

Ubuntu 14.04: apt-get install php5-mysqlnd