php artisan migrate: [PDOException]could not find driver - php

I have searched all over the Internet (including Stack Overflow) for an answer regarding this recent problem I've encountered.
I'm trying to install and run the latest version of the Laravel PHP Framework and am currently going through the QuickStart steps. When I get to the Migration steps after creating the view files and a 'user' table, I keep getting thrown with the 'PDOEXCEPTION' error -> 'could not find driver'.
Here are the steps I have taken so far in attempting to install Laravel.
System Specs -> Windows 7 PC with WAMP server installed and PHP5 installed as a separate folder.
Steps:
Installed 'Composer' Tool for PHP. After downloading the install file and running setup, it found the 'PHP' directory on my hard drive located on (C:\PHP) and continued to install via that PATH.
Installed 'Laravel' by using 'Composer' by typing in the following command into my command terminal via the 'PHP' directory (C:\PHP) -> 'composer create-project laravel/laravel blog --prefer-dist'
Went into my new 'blog' project (C:\php\blog) and modified the files 'C:\php\blog\app\routes.php', 'C:\php\blog\app\views\users.blade.php', 'C:\php\blog\app\views\layout.blade.php'.
Used the following command to create a migration within the 'blog' project (C:\php\blog) 'php artisan migrate:make create_users_table'. After creating this file, I modified it according to the Laravel online Quickstart Guide.
After I modified this program, I then typed in 'php artisan migrate' and that's when I keep getting the PDOEXCEPTION: 'could not find driver' problem.
I have checked my php.ini file and the extension for the php_pdo_mysql.dll is set and I still keep getting this error.
After spending a lot of time researching this error, I still cannot figure out what is causing this issue. Any help would be greatly appreciated.
Please help me guys!

I took The Shift Exchange's advice and downloaded Laravel Homestead and I now have my system up and running.
Use the following link for steps in installing Laravel Homestead properly: http://laravel.com/docs/4.2/homestead
Note that if you are using Windows, you'll probably have to use Putty to connect to your VirtualBox machine properly.

Related

Why Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found

I have a Laravel/Homestead project that is finally working locally. Now I'm trying to port it over to HostGator and can't get it running due to titled error. I've tried all the suggested solutions to no avail. Including:
composer require laravel/laravel
composer dump-autoload
composer install --no-scripts
composer update
composer update --no-scripts
Nothing works. Same error. If this is a clue, I also tried
php artisan clear-compiled
and get response of
Could not open input file: artisan
I'm about ready to give up on Laravel/Homestead. I've spent countless hours on this framework with nothing but problems to show for it. Would not recommend it to anybody.
You can see the error yourself here:
http://www.tekknow.net/MedAverter/medaverter/
Any suggestions before I throw in the towel?
For the artisan file, the artisan file is not required through includes, you have it in your root project, which is created when you create your Laravel project. Here is the file.
So you need to have that file in your project.
For the missing class, you try to require laravel/laravel but that is not the correct dependency. Again that github repo is a shell for a project, to have Laravel features you need to base of laravel/laravel and include laravel/framework.
Hope this clears up some confusing and can get you on the right track. Secondly you shouldn't port it over, but simply cloning your project and running composer install should be sufficient.
The problem turned out to be two issues.
1. The wrong version of PHP was running. If I ssh'ed into the hostgator server and did
php -v
It showed PHP 5.6.30 even though I had selected Php 7.1 in the cPanel PHP Selector. If I did
tekknow.net/phpinfo.php
it would say I was using 7.1. Called up HostGator tech support and they were able to change it to PHP 7.3.13.
Now if I do:
php artisan clear cache
I no longer get the error about
Parse error: syntax error, unexpected '?' in
/home1/sl1k7f3j/public_html/medaverter/bootstrap/app.php on line 15
which was an error caused by a version of php that doesn't support the ?? operator.
The second problem was a lack of memory issue. If I did
composer update
It would start to work but would fail in about 30 seconds with
Fatal error: Out of memory (allocated 709623808) (tried to allocate
34187559 bytes) in
phar:///opt/cpanel/composer/bin/composer/src/Composer/Json/JsonFile.php
on line 270
The HostGator tech rep could not figure out why that was happening but I got around that issue by manually uploading my local vendor folder to the host server.
Now when I go to http://tekknow.net/medaverter/ it works!

laravel failed to open stream fatal error when running php artisan serve command

i had recently installed laravel in windows through composer made a new project named project in my xamp's htdocs folder then run "php artisan serve" comand in cmd but it is giving me error "failed to open stream" here is screenshot here I ran "php artisan serve" comand error is shown in above image I also tried to search my problem on stack overflow but couldn't find any solution that can suit my problem
Most files are missing because you have not successfully installed Laravel.
Go to C:\xampp\htdocs\project> and type composer update --no-scripts or composer install
Since you are using xampp, once all the necessary files and packages are downloaded to your project you should be able to access your site through localhost without running php artisan serve by visiting
http://localhost/project/public
NB:Just ensure xampp is running
please go through the documentation first
https://laravel.com/docs/5.4#installation
you did not installed laravel projects correctly. you did not have vendor files. First you have to run :
composer install
dont need php artisan serve in xampp ... just go to
localhost/your_project/public
hope it helps !!!

bash: laravel: command not found

I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like
/opt/lampp/htdocs/learning-larvel/
Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.
Now, to create a new file for Laravel, when i open my Terminal and type
laravel new xyz
then it gives me a error which says bash: laravel: command not found
Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself.
I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/
Any help would be extremely thankful.
As the composer official getting started page points out:
There are in short, two ways to install Composer. Locally as part of
your project, or globally as a system wide executable.
if you wanna do composer -- or laravel -- in command line, you wanna install them globally.
Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
https://laravel.com/docs/4.2#install-laravel
I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.

error using composer to install cakePHP 3

i am lost...
i am trying to do it the right way and am following the Quick Start Guide for installing cakePHP 3 on my ubuntu machine.
Got composer installed. Directory is /var/www/cakephp
and am trying to issue:
php composer.phar create-project --prefer-dist cakephp/app mayapp
or
composer create-project --prefer-dist cakephp/app may app
then i am simply getting:
[InvalidArgumentException]
Could not find package cakephp/app with stability stable.
i do not have a clue what i am doing wrong. Any suggestions?
cakephp/app exists on https://packagist.org, and the command looks ok to me.
Which PHP version are you using? That package is only available with PHP 5.4.16 or later, so you must update if you want to use CakePHP.
However, it is a good idea to only use the same PHP version of your public hosting, using a newer version will lead to problems when deploying your code. If your webspace or public server does not have the latest PHP 5.6 running, ask for an update.
I got same issue. But, as previous answer, myapp does not exists on packagist.org, so, you must use laravel/laravel instead, and, after created, rename the new laravel folder to your desired name and move to htdocs (for xampp) or www (for wamp), then, and I do not know why, go to : localhost/laravel/public/
and replace laravel with the name you gave to your project folder instead the laravel one.
You will see Laravel 5 fonts will appear on screen.
That's means Laravel is running.
Hey Please try these steps.
Download XAMPP Server.
Install XAMPP server.
Go to ..\xampp\php\php.ini and open.
Add this line (extension=php_intl.dll) or if exist uncomment.
Download Composer setup from https://github.com/composer/windows-setup/releases/
Install composer and give php.exe file in path
Open cmd and check now php version using command php -v. if its showing php version its means its working.
Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
Finished folder created in htdocs.
Hope this is helpful for you.

End of file in Symfony package for new Laravel project on Homestead

I'm trying to make new Laravel app on my Homestead virtual machine (virtualbox on Win 7 x64).
I'm using this command:
composer create-project laravel/laravel api --prefer-dist
Durning autoload file generation I'm getting end of file error in api\vendor\symfony\console\Input\InputInterface.php
Symphony ver. 2.7.1
This file ends on line 150 (instead of 151) with this contents:
" public function set"
I have cleared the composer cache, updated it, but still no luck...
I checked downloaded zip and file in question there appears to be complete...
Please help...I'm running out of ideas...
PS. Sorry for bad English... If you need more info then please post here.
The problem was releated to Homestead on Windows. I switched to xampp on windows and downloaded everything without problem.

Categories