Laravel 5 migration error - php

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.

Related

Fatal error: Uncaught ReflectionException: Class "env" does not exist

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

DB error : include(database-connection.php): failed to open stream: No such file or directory

I've Setup the php project, installed all necessary packages. I'am able to launch the website.
However, when I try logging into it(submit username and password), I get the error as "include(database-connection.php): failed to open stream: No such file or directory"
I've checked the documentation and performed
composer install
php artisan migrate:fresh --seed
updated the .env file with correct DB credentials
Could someone help me out with further troubleshooting, I'm performing this activity for the first time.

Laravel Uncaught exception 'ReflectionException

Im getting an error when trying to launch a Laravel App .
Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in C:\xampp\htdocs\vendor\laravel\framework\src\Illuminate\Container\Container.php:735
I have checked the .env file for spaces and found none. I also replaced each file in the config folder in a attempt to find out which one would throw the error. I also tried doing a dump just the mentioned line
dump($concrete, debug_backtrace());
I have also tried running composer dump-autoload and composer dump-autoload -o which promted me to put the composer.json file into the config directory
Then when ran again threw the error stating "Could not scan for classes inside database which does not appear to be a file nor a folder".
How can a isolate and sort this issue out ?
do:
$ composer dump-autoload -o
and try again

When i try to command through terminal 'php artisan serve' it gives Fatal error in ubuntu

Would you please help me to find out my installation problem of Laravel. I installed composer then installed laravel. When i try to run the project through php artisan serve, it gives following error.
Warning: require(/opt/lampp/htdocs/laravel_project/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/laravel_project/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/opt/lampp/htdocs/laravel_project/bootstrap/../vendor/autoload.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/laravel_project/bootstrap/autoload.php on line 17
I mention some things that the installed laravel folder contains totalling 120 items and total size 651kb. inside the projct directory, there is no folder named vendor. i'm using ubuntu 16.
If vendor folder is present in your directory, try this command. It may help you.
cp .env.example .env
php artisan key:generate
As per #Gravy mentions in the comments, you need to run composer install in order to generate the autoload.php file.

Deleting migrations results in an Exception

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

Categories