I have a bad experience while installing laravel. However, I was able to do so and move to the next level. I used generators and created my migrations. But when I type the
Ran into the same issue here, and turns out this is because PHP at the command line uses a different php.ini
file from the browser version, which is why it looks like it's loading the extension correctly when you look at phpinfo()
in a browser.
As per this answer, you just need to run:
php --ini
At the command line, which will tell you the path to the currently loaded php.ini
(probably actually a php-cli.ini
file located in the same place as your regular php.ini
file).
Once you've found that, modify it with the pdo extensions you want (in this case for MySQL):
extension=pdo_mysql.so
Or, for any other users that are on Windows using some kind of WAMP server, it probably looks like this instead:
extension=php_pdo_mysql.dll
I was also getting the same error --> "[PDOException]
could not find driver "
After that I used many commands but not didn't get any help
Finally I used the following command, which solved my problem.
sudo apt-get install php5-sqlite
If you are using Laravel 5.x, and the error is from trying to modify the attributes of a column, it is possible the error comes from a missing pre-requisite.
Try this:
composer require doctrine/dbal
Then try running your migrations.
From here: https://laravel.com/docs/master/migrations#modifying-columns
In my case I wasn't aware that the PHP run by Apache was different from the one run by CLI. That might be the case if during configuration in httpd.conf you specified a PHP module, not being the default one your CLI uses.
You must be installing the latest version of php mysql
in my case I am install php7.1-mysql
Try this
sudo apt-get install php7.1-mysql
I am using the latest version of laravel
Please check your Laravel .env
file also. Make sure DB_CONNECTION=mysql
, otherwise it won't work with MySQL. It tried to load something else.