Class 'Illuminate\Database\MySqlConnection' not found error in laravel 5.2 - laravel-5

While loading the dynamic page in laravel 5.2 I am getting below error.
FatalThrowableError in ConnectionFactory.php line 217:
Class 'Illuminate\Database\MySqlConnection' not found
what might be the issue.how to solve these I have tried below commands none of these helped to rectify the above issue.
composer dump-autoload
php artisan cache:clear
php artisan route:cache
php artisan config:cache

For me deleting the vendor directory and re-running composer install fixed this problem.

Just do a sudo rm -R vendor in your projects directory followed by a composer install and everything should work.

I am not using Laravel 5.2 but 5.7.28 instead. I followed #jgleesti's solution deleting the vendor folder and re-running composer install. It made it better but didn't solve my problem. So I did some more steps to solve my issue.
sudo apt-get --purge remove php-common
sudo apt-get install php-common php-mysql php-cli php-bcmath
Not sure how, but it works for me.

I've got the same issue, it seems the PDO is not working on my site,
Tried to purge the PHP / MySQL
Reinstall PHP / MySQL
It seems that the module for pdo loaded from PHP – ini and PHP – m

Related

How to fix the error "In order to use the Auth::routes() method, please install the laravel/ui package" in laravel 8

On localhost every thing work okay but when I try to deploy laravel project to heroku I get this error:
message "In order to use the Auth::routes() method, please install the laravel/ui package"
I have tried the next things to fix this error but they are not working for me
composer require laravel/ui
php artisan ui bootstrap --auth
php artisan cache:clear
php artisan config:cache
php artisan route:cache
Manually clear the .php files within the bootstrap/cache folder and then php artisan config:cache.
And all of this solutions didn't work for me
Which version of laravel/ui are you trying to install? The newest - 4.x at the time of writing, is not compatible with Laravel 8. So you want to install 3.x for a version that supports Laravel 8.
composer require laravel/ui:^3.0

laravel new blog not work mockery/mockery 1.4.0

Today I wanted to create a new project with Laravel with this command
laravel new blog
But I get this error
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mockery/mockery 1.4.0 -> satisfiable by mockery/mockery[1.4.0].
- mockery/mockery 1.4.0 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.
Why should php7.3 be read when Laravel himself says at least php7.2.5 ???
Run composer update.
The reason:
Your PHP version is too low. You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0
The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.
My bug report can be found here
As of 2020-05-21, the zip files that laravel new ___ uses will try to install mockery/mockery version 1.4. This won't work with versions of PHP below 7.3. In order to fix this, run composer update, and mockery will be downgraded to a compatible version.
I had the same problem today for new Laravel projects. The composer.json file was showing "mockery/mockery": "^1.3.1" but still was showing the same error. Delete also the composer.lock file and run composer install.
Assuming you are trying to create a new laravel project called blog this is what I did to fix the error after running laravel new blog
cd into blog
run composer update
Create a .env file. You can just make a copy of .env.example and rename the copy to .env. In case you try to start the dev server using php artisan serve and the app launches with a 500 error, run these commands:
php artisan key:generate
php artisan cache:clear
php artisan config:clear
composer dump-autoload
I had the problem when trying to create new Laravel applications,I updated php version using the following commands and it worked.
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install -y php7.4 php7.4-gd php7.4-mbstring php7.4-xml
Delete the composer.lock file and run composer again
composer install
You can just run
composer create-project --prefer-dist laravel/laravel <project_name>
It'll automatically fall-back to mockery^1.3.1
I also faced these problems.
Problem 1
- Installation request for facade/ignition-contracts 1.0.2 -> satisfiable by facade/ignition-contracts[1.0.2].
- facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
Problem 2
- Installation request for mockery/mockery 1.4.2 -> satisfiable by mockery/mockery[1.4.2].
- mockery/mockery 1.4.2 requires php ^7.3 || ^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
Problem 3
- facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
- nunomaduro/collision v4.2.0 requires facade/ignition-contracts ^1.0 -> satisfiable by facade/ignition-contracts[1.0.2].
- Installation request for nunomaduro/collision v4.2.0 -> satisfiable by nunomaduro/collision[v4.2.0].
I had deleted the composer.lock file and executed composer install command.
My problem solved.
This might be stale, the issue here is that the php needs to be updated to version that will be compatible.
delete the composer.lock file and autoload file in vendor i.e vendor/autoload in your project
upgrade php version from php.net
run composer install --no scripts
run composer update
php artisan migrate
php artisan key:generate

Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found when I make composer install --optimize-autoloader --no-dev

I'm deploying my Laravel application and want to optimize the autoload, normally I would run the command
composer install --optimize-autoloader --no-dev
This is an application that runs Laravel 5.8. I am getting the following error:
In Application.php line 662:
Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
Script #php artisan package:discover --ansi handling the
post-autoload-dump event returned with error code 1
If you do not have development dependencies on the laravel-dump-server, remove the following line from composer.json.
"beyondcode/laravel-dump-server": "^1.0".
Then run the following command.
composer install
Or, even easier, just run the following.
composer remove --dev beyondcode/laravel-dump-server
In my case I have done below steps
Delete vendor folder
Run: composer self-update --1
And again run: composer install
Then you can run any command you want
A detail around this issue has been written in one of the GitLab issues on
https://github.com/GoogleCloudPlatform/php-docs-samples/issues/736
This issue explain why this dev package creates problem on your build server.
For me, The issue resolved after I've added this in composer.json
{
"scripts": {
"gcp-build": [
"composer install --no-dev"
]
}
}
This will remove all the dev dependencies
I simply do
composer update
and then I redo again
like myself I run
php artisan migrate
Solution 1
composer install --optimize-autoloader --no-dev
if this not work try and getting error undefine index: Name
Solution 2
Step1: `composer self-update --1`
Step2: composer install
Bingo...!!!
You may need to run composer update with the --no-plugins option.
composer update --no-plugins

Mcrypt PHP extension installation doesn't work

I am trying to install laravel via composer ( http://laravel.com/docs/quick#installation ) and I got stuck at the point where it requires Mcrypt extension
Mcrypt PHP extension required.
I installed Mcrypt extension using brew. But still it throws the same requirement error.
I also tried changing the path as suggested here but my which php doesn't show anything other than
/usr/bin/php
Am I doing something wrong with assigning path at ~/.bash_profile? why is "which php" output still the same. and why is mcrypt installation not working on laravel workout?
What command did you use to install mcrypt? It is possible that you try to install the mcrypt extension for the wrong php version.
Try debugging the situation with
php -v
and
ls -al /usr/bin/php
There is a different install recipe for version 5.5 and 5.4 of PHP.
brew install php54-mcrypt
brew install php55-mcrypt
OK, I was fed up off all other solutions which weren't working, so finally downloading and compiling php from source itself worked.
So here's what I did:
Download php from official site
Follow following instructions
cd to/extracted/php/folder
cd /ext/mycript
phpize
./configure
make
make test
sudo make install
Add extension=mcrypt.so to /etc/php.ini file.
Now restart the server
sudo apachectl restart
You are good to go, Cheers! :)

Installing laravel and composer on Debian 6

I want to use laravel, so, firstly I have to install composer, I uploaded laravel in a folder "laravel" now i go to the folder and I do this
curl -sS https://getcomposer.org/installer | php
according the site of composer...
So, now, according laravel I should do this
composer create-project laravel/laravel
but returns "composer command not found"
When I finished installing composer I get this Use it: php composer.phar
So, I try again php composer.phar create-project laravel/laravel
and it runs,but it stays as Installing dependencies (incluiding require-dev) for a long long time.
My enviroment is Debian 6, and its a cloud server, so, internet should not be a problem.
It just stays like that, any idea what I'm doing wrong? How to solve this and make it run?
Thanks
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
# if you're installing as root or privileged account, don't leave the permissions on default 777
$ chmod 755 /usr/local/bin/composer
$ composer install

Resources