I know this is a duplicate question however whatever I tried, unfortunately no luck. (To add, I am using MAMP)
I believe I successfully setup the database connection because, using the registration form (Auth/register), after submitting the form, I was getting the error PDO Exception: Driver not found
before, but after changing to my MAMP to PHP 5.5.17
from the default(PHP 5.6.1
), I started getting error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.users' doesn't exist
, which I believe shows that the database connection is working and it's just the 'users table' is not created.
Here starts my problem. When I try to use php artisan migrate
or migrate:{anything}
in the terminal, it's throwing the error:
[PDOException]
could not find driver
But what I want to do is to use php artisan migrate
to be able to create tables and migrate them.
<?php echo phpinfo(); ?>
to if pdo files are successfully installed.
I get the result:so I think it seems okay.
/MAMP/bin/php/php5.6.1/conf/php.ini
and adding extension=pdo_mysql.so
in the code, but I have mine already placed there.php -i | grep PDO
in the project root (/MAMP/htdocs/proj), I got:PDO
PDO support => enabled
PDO drivers => sqlite
PDO Driver for SQLite 3.x => enabled
php -i | grep Conf
and `php --ini also outputs:Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.1/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.1/conf/php.ini
but php artisan migrate
still throwing the same error
I chose MAMP to use version 5.5.17 instead of 5.6.1 in the browser (from MAMP Preferences), however this time terminal was running the 5.6.1. What I did was first checking which PHP
command and then, running the nano ~/.bash_profile
command; and editing the version document. Now everything is up and running :)
What you see in the browser is that you have PDO enabled for PHP running through apache. But this does not mean you have it enabled for PHP running through CLI (in fact they are using two separate ini files). To confirm that you can try:
php -i | grep PDO
And you will see it is missing or not enabled. So what you need to do is to find which php.ini is using the PHP running through CLI and add the PDO module there:
php -i | grep Conf
It will output something like:
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini