ErrorException + unlink + Resource temporarily unavailable + Laravel 5.5 - php

I'm a newbie in Laravel World. I've downloaded a project from gitlab.com and tried several time to run that project in my laptop.
In that project I've 6 migration files:
users_table
password_resets
posts_table
comments_table
profiles_table
categories_table
When executing php artisan db:seed command I'm getting the following error:
C:\xampp\htdocs\photoblog-master\photoblog-master>php artisan db:seed
Seeding: UserTableSeeder
[ErrorException]
unlink(C:\xampp\htdocs\photoblog-master\photoblog-master\public\uploads/user-picture\61224db90375756038856cd51e1c48a7.jpg): Resource temporarily unavailable
Would you please tell me how can I solve this error?

Is the file C:\xampp\htdocs\photoblog-master\photoblog-master\public\uploads/user-picture\61224db90375756038856cd51e1c48a7.jpg in use?
I have a similar issue when I opened a file and tried to delete it without fclose it first.

Related

How do I solve a php artisan make:auth error?

I'm new to Laravel and I tried to use php artisan make:auth. But I keep getting a permission denied error. What exactly is wrong and how do I resolve this?
UnexpectedValueException
The stream or file "C:\Windows\System32\vfyp\storage\logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied
at C:\Windows\System32\vfyp\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:146
142▕ restore_error_handler();
143▕ if (!is_resource($stream)) {
144▕ $this->stream = null;
145▕
146▕ throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url));
147▕ }
148▕ stream_set_chunk_size($stream, $this->streamChunkSize);
149▕ $this->stream = $stream;
150▕ }
C:\Windows\System32\vfyp\vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php:48
Monolog\Handler\StreamHandler::write()
C:\Windows\System32\vfyp\vendor\monolog\monolog\src\Monolog\Logger.php:327
Monolog\Handler\AbstractProcessingHandler::handle()
I think in Laravel 8 php artisan make: auth will not work. For laravel 8 you have to use Laravel Jetstream (built-in with version 8) and Fortify package for default authentication. But if you are using Laravel 6 or 7 version . you have to use the following commands
composer require laravel/ui:^2.4
php artisan ui vue --auth
for more details, you can check Laravel Official Documentation -> Security->Authentication

php artisan serve not working giving error In ProviderRepository.php line 208:Class 'Laravelium\Sitemap\SitemapServiceProvider' not found

I'm working for the first time in laravel while setting up the already developed project in my local computer and running php artisan serve i'm getting this error
In ProviderRepository.php line 208:
Class 'Laravelium\Sitemap\SitemapServiceProvider' not found
Issue is resolved by just follow these step. Go to your project > bootstrap->cache->config.php remove the provider and aliases from the cached array manually.

Error: SQLSTATE[HY000] [1049] Unknown database 'old_db' when in '.env' a new db is defined

After the database has moved to a different server and a different schema name, I updated the .env file and when entering php artisan config:cache it writes the error message
"SQLSTATE[HY000] [1049] Unknown database 'OLD_DB'" - (OLD_DB refers to
the database name before the change).
I don't know why it still looks for the old name as if I didn't update the .env file. I also tried to write php artisan cache:clear and even just php artisan alone and received this error. Also composer update did not help - in the end it tries to run #php artisan package:discover.
Eventually I managed to solve the problem by clearing the cache:
rm -f bootstrap/cache/*
This allowed me to (finally) run:
php artisan config:clear
and the new configuration was on the air.

Cannot start artisan serve in laravel 5

I am using laravel 5, when I try to start server from
php artisan serve
I get following error :
[Symfony\Component\Debug\Exception\FatalErrorException]
App\Providers\RouteServiceProvider::App\Providers{closure}(): Failed
opening required 'D:\Test\app\app\Http/routes.php'
(include_path='.;C:\xampp\php\pear')
I tried composer dump-autoload, it was successfull, but when i do
composer update
I get the same error.
How to resolve it?
routes.php was never in app\Http, it was in someother dir. Moving it back where it belongs fixed the issue

Laravel php artisan migrate not working

When I try to use 'php artisan migrate' in Laravel I get 2 errors:
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database (SQL: select * from sqlite_master where type = 'table' and name = migrations)
[PDOException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database
I created a storage/database.sqlite file before attempting the migration. I also edited the config/database.php, making the default=sqlite. I am using windows and have sqlite3 installed.
Has anyone encountered this/know how to get past it?
I had the same results, in my case the /database/database.sqlite file was not empty.
I deleted the contents reran
php artisan migrate and the migration table was created successfully.
Running Laravel in Windows under the Powershell console I was getting the same errors as the original poster. The documentation reads After creating a new SQLite database using a command such as touch database/database.sqlite... The Powershell equivalent of touch is typically Out-File FILENAME
PS D:\Learning\PHP-Laravel\database> out-file database.sqlite
PS D:\Learning\PHP-Laravel> php artisan migrate
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 26 file is not a database...
When creating my database.sqlite file I received these errors. I deleted the database and recreated it using the New-Item command and it worked properly
new-item -ItemType File -Name database.sqlite
PS D:\Learning\PHP-Laravel> php artisan migrate
Migration table created successfully.
Check the file you made as .sqlite and make sure it is empty if not then make it empty
database/db.sqlite
then run migration
If somebody came here with the same error with manually created table in sqlite db - it could be the sqlite version mismatch. I solved the same error by emptying db file and recreate the table with getConnection()->statement('CREATE TABLE
check if your .sqlite file is empty and the is no indentation(no spaces)

Categories