PHP警告:PHP启动:无法加载动态库'/usr/lib/php/20151012/mysql.so'

I recently installed EHCP with all the necessary packages and now everytime I try to run my laravel project by typing php artisan serve, I get the following error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mysql.so' - /usr/lib/php/20151012/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0

Please help, thank you.

Do you have the mysql extension installed? If not, you may need to install it.

apt-get install php-mysql

In ubuntu 16.04 and above (as I can remember), this will install the module for PHP7 by default. So you need to check your php version and install the relevant one.

Ex: apt-get install php5.6-mysql

Then check you have the module installed by running:

php -m | grep mysql

Hope it helps!