In my Application, when I run php artisan migrate:make create_location_user_table, then delete the generated file (doesn't matter if I delete the line created in vendor/composer/autoload_classmap.php, the php artisan migrate:refresh command throws an error:
include(<path_to_project>/database/migrations/2015_06_21_105357_create_location_user_table.php): failed to open stream: No such file or directory
After running commands to get rid of the faulty autoload entry, I get an exception. The commands I tried are: composer update, composer dump-autoload, php artisan clear-compiled, php artisan optimize.
PHP Fatal error: Class 'CreateLocationUserTable' not found in <path_to_project>\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php on line 323
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreateLocationUserTable' not found
Go into your mysql database manually (PHPMyAdmin) and remove the migrations table. With the steps you've taken above and doing this should solve your issue
Related
After lunching the command php artisan optimize , i got
fatal error: Uncaught ReflectionException: Class "env" does not exist
I have tried deleting the bootstrap/cache/ and runing composer update but nothing works,
everytime i tried to run a php artisan command/composer command i got the same problem. am really stuck. any help.
You can clear cache using:
php artisan optimize:clear
Or only clear config cache using:
php artisan config:clear
https://dev.to/kenfai/laravel-artisan-cache-commands-explained-41e1
Maybe you have something wrong in your config/database.php file. If it is the case when you run composer update the console will show some error at the end of execution due the config/database.php file
Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125
I am new at Laravel and I have a problem When I use php artisan db:seed, this error appeared:
include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php):
failed to open stream: No such file or directory
at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
440| * Prevents access to $this/self from included files.
441| */
442| function includeFile($file)
443| {
> 444| include $file;
445| }
446|
I have no idea why does it happens.
There was no error when I used php artisan migrate.
I have already tried php artisan migrate --seed and php artisan migrate:refresh --seed.
Can anyone please help me?
You should try using composer dump-autoload.
From this answer in SO:
Basically, because Composer can't see the migration files you are
creating, you are having to run the dump-autoload command which won't
download anything new, but looks for all of the classes it needs to
include again. It just regenerates the list of all classes that need
to be included in the project (autoload_classmap.php), and this is why
your migration is working after you run that command.
I delete a migration file manually. Now I try to run the migrations with:
php artisan migrate:refresh
I get an error:
[ErrorException]
include(C:\xampp\htdocs\NightClubs/database/migrations/2014_10_12_000000_cr
eate_users_table.php): failed to open stream: No such file or directory
This is the name of the migration file that I deleted. What to do?
The schema for migrations records the names of the files run through the artisan migrate command.
If you experience errors after deleting a migration class file, simply delete the record from the migrations table. If you have the liberty, completely dismantle the database and start from scratch.
I use Laravel 5.2 and I created database tables by running
php artisan make:migration create_categories_table --create=categories
and
php artisan make:migration create_posts_table --create=posts
and then I run php artisan migrate, and tables are created in database. But after I made some changes in migration file "create_posts_table.php" and run
php artisan migrate:rollback
I got an error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreatePostsTable' not found
PHP Fatal error: Class 'CreatePostsTable' not found in E:\programfiles\xampp\htdocs\deneme\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php on line 336
my create_posts_table.php is
I tried composer update, composer dump-autoload but that hasn't fixed the problem.
I was getting the same problem. May this helps somebody: run composer dump-autoload before running migrate:rollback.
Before you run a migration, you should run the following commands to make sure cache has been cleared:
php artisan clear-compiled
php artisan optimize
This will make sure your new migration class has been registered correctly.
I was using migration with a database. Then i removed that database and created new one. Then i created migration files from the terminal via php artisan make:migration create_users.
Then i came back and tried to run the migration and it throws the following error with php artisan migrate
Error:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"/opt/lampp/htdocs/laravel/storage/logs/laravel.log" could not be
opened: failed to open stream: Permission denied' in
/opt/lampp/htdocs/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:95
And also a few more.
I googled and found that composer dump-autoload wil work, But it didn't and composer dump-autoload throws the same error.
php artisan migrate:reset throws the same error as php artisan migrate:reset.
Thanks
Change Permission of log folder of laravel
Give Read & Write permission
storage/logs
Changing Database:
1: Change DB name in config/database.php
2: root/.env DB_DATABASE=databasename
It's not the problem of autoloading. It is a problem of file permissions. Check if webserver can write to the storage/logs directory.