Table of Contents
ReflectionException: Class ClassName does not exist – Laravel
composer dump-autoload should fix it.
What does composer dump-autoload do in Laravel?
composer dump-autoload will regenerates the list of all classes that need to be included in the project (autoload_classmap.php)
composer require intervention/image, Fatal error: Allowed memory size of 1610612736 bytes exhausted but already
For windows
php -d memory_limit=-1 “C:\ProgramData\ComposerSetup\bin\composer.phar” update
For linux
php -d memory_limit=-1 /usr/local/bin/composer install
Artisan not running
/vendor/autoload.php): failed to open stream: No such file or directory in…/artisan on line 18
composer install
#Add some more dependencies
composer update
(Intervention\\Image\\Exception\\NotWritableException(code: 0): Can’t write image data to path
When I save image I get 500 server error.
At first, I thought it was a problem with the permissions of the directories where the images were saved
But the problem in my case came from the fact that migrated the project from Windows 10 to Linux and I used “\” instead of “/” and Linux interprets them differently.
In Linux, the path separator is /. In Windows, it is either \ or /. So just use forward slashes and you will be fine.
or
You can also use DIRECTORY_SEPARATOR constant instead of \ or /. Usually, you’ll want to redefine it to have a shorter name, like:
define(‘DS’, DIRECTORY_SEPARATOR);
//Windows Code:
$file = Image::make($file)->resize(160, 40)->save(base_path(‘storage\app\public\logos/’).$filename,90);
//Linux Code:
$file = Image::make($file)->resize(160, 40)->save(base_path(‘storage/app/public/logos/’).$filename,90);
Specified key was too long; max key length is 767 bytes
When running php artisan migrate:fresh get this error:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes …
The solution was to edit AppServiceProvider.php file and inside the boot method set to a default string length:
use Illuminate\Support\Facades\Schema; public function boot() { Schema::defaultStringLength(191); }
Hello there!
I hope you find this post useful!I'm Mihai, a programmer and online marketing specialist, very passionate about everything that means online marketing, focused on eCommerce.
If you have a collaboration proposal or need helps with your projects feel free to contact me. I will always be glad to help you!