PDOException could not find driver - laravel

I'm getting this error when i try to migrate. Im trying to run my project on postgres on MAC OS. Any suggestion how can i do this? I uncomment this in php.ini
but i nothing happend.
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

add this line in php.ini
extension=pdo_mysql.so
and then install the PDO by running following command:
sudo apt-get install php-mysql
EDIT
and also try to restart your computers sometimes it happens that restarting apache did not reloads the configuration

Related

In Laravel - could not find driver on xampp using ubuntu 16.04

I am working on xampp 7.3 version of PHP.
I am facing the below error.
Illuminate\Database\QueryException: could not find driver (SQL: select name from table where id = e690ddc2-a2b6-4aad-8a73-dab1771c0ea6 limit 1) in file /opt/lampp/htdocs/ProjectFolder/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669
Also, I have uncommented the pdo_mysql.dll in php.ini file it still giving me an error.
Also, it is working in the windows system but not in Ubuntu16.04.
how can solve this?
You should install the necessary packages
sudo apt-get install php*-mysql
Then uncomment the MySQL extensions on php.ini and restart your server
sudo service apache2 restart
In your project set the correct parameters and in the root of your project run
php artisan config:cache
I resolve this issue on Ubuntu 18.04 by:
"Control C" out of the php artisan serve command to stop the application.
Stop all the servers running on XAMPP -> (Apache, MySQL and ProFTPD).
Enable mysql inside of XAMPP via path $ cd /opt/lampp/etc .
$ sudo nano php.ini or open in your choice of text editor. I use PHPStorm.
Search for "php_mysql.dll".
Removed the ";" in front of ";extension=php_mysql.dll" -> hit save.
Back in the terminal -> $ cd.. back one folder into the /opt/lampp.
Run $ sudo apt-get install php*-mysql. -> Could take a couple minutes based on your internet connection.
After the install is complete -> restart all the XAMPP servers.
Run $ php artisan config:cache.
Run $ php artisan serve.

How to fix this error that pops up after migrations in Laravel

Am new to Laravel ,so been trying to do migrations and this error keeps popping up in the terminal
so after editing my .env file and trying to run php artisan migrate i get the error that i have attached below,i have tried to search the error around,but cant get any meaningful solution
You need to have the php-mysql extension installed on your machine.
You can install this extension with the following command:
sudo apt-get install php-mysql
Hope this helps! :)

hInterface 'Throwable' not found

when querying the database with sql error laravel throws Throwable interface not found instead of the query exception.
i have a same trouble yestoday with 'laravel new demo', meybe the repository server has error before. i rebuild my laravel project with 'composer create-project laravel/laravel=5.4 demo --prefer-dist' this afternoon, it work! do like this.
In my last project, I got this error too. I used php 5.6.30 version. When i upgrade to 7.0.1 version, everything is fine. http://php.net/manual/en/class.throwable.php
I was using php5.6 and got this after I did composer update.
So I installed the php7.1 following this answer
Then I disabled php5.6 using
sudo a2dismod php5.6
and then I ran the following to enable 7.1
sudo a2enmod php7.1
and finally restarted apache2 using.
sudo service apache2 restart
and it worked.
I fixed mine when I did a netstat -tln and found out the mysql is running 0:0:0:0:3306, and on my .env file is set to DB_HOST= 127.0.0.1. I changed it to DB_HOST=localhost and is working fine right now.

Laravel Migration Error :: PDOException, Could not find driver

I am trying to make a laravel and stucked when migration. when i enter php artisan migrate in terminal, showing PDOException error. attaching my screenshot of terminal and phpinfo.
What i sthis issue, How can i solve this,
I am using Xampp.
Anybody please help me.
Thanks
Try re-installing Xampp? You could use Laravel homestead for a virtual machine, it makes sure you have the proper PHP version and the required dependencies needed to install and avoids having to run Xampp or MAMP or WAMP or any of the amps.
It looks like Xampp cannot find: /usr/lib/php5/20121212/php_pdo_mysql.dll, so make sure that file exists.
You may need to re-install PHP PDO on your machine, refer to: http://php.net/manual/en/pdo.installation.php
Also per PHP docs:
PDO and all the major drivers ship with PHP as shared extensions, and
simply need to be activated by editing the php.ini file:
extension=php_pdo.dll
Please check you have installed more than one php version in your system, one is running for web server and another for php CLI, using PHP_INFO for web and php --ini in commandline, if different version found then upgrade or downgrade means make it one version configuration, and make sure PDO is enable in your system.
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6

Errors while installing Magento on Cent OS with Nginx and PHP-FPM

I have been fighting this for hours now and finally found a resolution so I wanted to share it with anyone else who has trouble.
If you receive the following errors while installing Magento on Linux while running Nginx and PHP-FPM then try the answer below:
PHP extension "dom" must be loaded.
PHP extension "mcrypt" must be loaded.
PHP extension "gd" must be loaded.
Try running:
yum install php-xml php-gd php-mcrypt
I was wondering why this wasn't working and I was dumbfounded for hours.
The trick is to restart php-fpm once you have everything installed. I kept restarting Nginx.
Run the following:
service php-fpm restart
Hope this helps someone!

Resources