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
Related
i am trying to create api token for my apis when my API are run in postman I get this error
LogicException: Unable to read key from file file://C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-private.key in file C:\Users\vivek\pregent-app\vendor\league\oauth2-ser
I did some goggling and fount that I need to do
php artisan passport:keys
but when I do I am getting the following error
file_put_contents(C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-public.key): Failed to open stream: No such file or directory
inorder to clear this error I tried php artisan config:cache still I am getting same error how can I solve this
note I am using larvel 9
this is the error I am getting
file_put_contents(C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-public.key): Failed to open stream: No such file or directory
at C:\Users\vivek\pregent-app\vendor\laravel\passport\src\Console\KeysCommand.php:54
50▕ file_put_contents($privateKey, Arr::get($keys, 'privatekey'));
51▕ } else {
52▕ $key = RSA::createKey($this->input ? (int) $this->option('length') : 4096);
53▕
➜ 54▕ file_put_contents($publicKey, (string) $key->getPublicKey());
55▕ file_put_contents($privateKey, (string) $key);
56▕ }
57▕
58▕ $this->info('Encryption keys generated successfully.');
1 C:\Users\vivek\pregent-app\vendor\laravel\passport\src\Console\KeysCommand.php:54
file_put_contents()
2 C:\Users\vivek\pregent-app\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Laravel\Passport\Console\KeysCommand::handle()
you can try these commands
php artisan optimize:clear
once your cache is clear then you can do this commands
php artisan
I have successfully install Laravel with Sail, the app is just fine, I can run it using sail up. however I am unable to migrate the database, everytime I run sail artisan migrate the following error thrown.
There is no existing directory at "/home/dariel/www/2021/nsmart/storage/logs" and it could not be created: Permission denied
at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:172
168▕ set_error_handler([$this, 'customErrorHandler']);
169▕ $status = mkdir($dir, 0777, true);
170▕ restore_error_handler();
171▕ if (false === $status && !is_dir($dir)) {
➜ 172▕ throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and it could not be created: '.$this->errorMessage, $dir));
173▕ }
174▕ }
175▕ $this->dirCreated = true;
176▕ }
+10 vendor frames
11 [internal]:0
Illuminate\Foundation\Bootstrap\HandleExceptions::handleException()
I am stuck at this point, any help would be appreciated. thanks in advance.
You can try this
php artisan route:clear;
php artisan config:clear;
php artisan cache:clear;
sail artisan migrate;
As the error states: There is no existing directory at /home/dariel/www/2021/nsmart/storage/logs Permission denied. So you have to run mkdir /home/dariel/www/2021/nsmart/storage/logs and done...
Remember to have storage folder accesible for the process running your artisan command, it needs to use any folder inside storage.
And, if I am not wrong, sail up will give you an error, so that is why it is trying to do something in the logs folder.
Running php artisan dusk get the error:
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED
(Session info: headless chrome=85.0.4183.83)
Versions:
OS: Windows 10 v1903 build 18362.1016
Chrome: 85.0.4183.83
Laravel: v6.18.37
Dusk: v5.11.0
Phpunit: v8.5.8
Tried:
Disable firewall
Set test website to use localhost (was myapp.local)
Can access all pages using Chrome browser
Check that vendor/laravel/dusk/bin/chromedriver-win.exe is executable (-rwxr-xr-x)
php artisan route:clear
php artisan cache:clear
php artisan config:clear
composer dump-autoload
google "Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED"
The server localhost:9515 appears to be running while tests executing as I get the following response in Chrome when trying it:
{
value: {
error: "unknown command",
message: "unknown command: unknown command: ",
stacktrace: "Backtrace: Ordinal0 [0x0037D383+3134339] Ordinal0 [0x0026A171+2007409] Ordinal0 [0x0010AEE8+569064] Ordinal0 [0x000AD12C+184620] Ordinal0 [0x000ACF0A+184074] Ordinal0 [0x00081FD7+8151] Ordinal0 [0x00082496+9366] Ordinal0 [0x00082B40+11072] Ordinal0 [0x00280CD9+2100441] GetHandleVerifier [0x004EB75A+1396954] GetHandleVerifier [0x004EB3D9+1396057] GetHandleVerifier [0x004F7126+1444518] GetHandleVerifier [0x004EBCE8+1398376] Ordinal0 [0x00277F51+2064209] Ordinal0 [0x00081D35+7477] Ordinal0 [0x00081991+6545] GetHandleVerifier [0x006BF31C+3312796] BaseThreadInitThunk [0x76986359+25] RtlGetAppContainerNamedObjectPath [0x771D7C24+228] RtlGetAppContainerNamedObjectPath [0x771D7BF4+180] (No symbol) [0x00000000] ",
}
}
DuskTestCase driver:
/**
* Create the RemoteWebDriver instance.
*
* #return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless',
'--window-size=1920,1080',
]);
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
Does anyone have any clues on what else to try? Or does anyone else know a resolution?
I faced the same issue and for me what worked was setting the APP_URL parameter in the .env file as:
APP_URL=http://127.0.0.1:8000
As that was the same port on which my php artisan serve would also serve the website i.e.
Laravel development server started: http://127.0.0.1:8000
I'm putting this out there for others that might face the same thing as me.
It turns out Laravel Dusk expects us to run php artisan serve before running php artisan dusk! The ERR_CONNECTION_REFUSED error refers to not being able to connect to the http://localhost:8000 URL of the application itself, because it's not running.
This does make sense, but I simply didn't know and the documentation was not clear on that (I had to deduce it). The ChromeDriver, however, is started automatically by Dusk at execution time.
The only thing that helped me with Laravel 9 is to set APP_URL=http://laravel.test in the .env.dusk.local file.
Fixed it by following these steps:
Remove vendor folder and remove composer.lock
php composer.phar install
Check your current Chrome Version - you can check it by going to https://www.whatismybrowser.com/detect/what-version-of-chrome-do-i-have
Download the WebDriver for Chrome that matches your current Chrome Version from http://chromedriver.chromium.org/downloads
Manually remove old chromedriver-win.exe version from vendor\laravel\dusk\bin and put the one you downloaded there. Note that you will have to rename the file.
After doing step 2 above the error message changed which prompted the remaining steps.
To fix this error you will need to update .env file APP_URL parameter to your local server url as below
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:XZoWMB3aWom/V3iZy870VSQjMsBdGCHYdWbRuNb6aY0=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000 #(This can be url to your local environment)
For me the error disappeared after setting .env APP_ENV=development and i keep .env.dusk.development also same.
I was trying to run the dusk after installing the new Laravel 8.77 and faced the following error and found the solution by creating new .env.dusk.local file. You have to create .env.dusk.{environment} as per your current environment.
In your newly created env file, you need to define proper URL for ex. http://testing-laravel.local by creating virtual host.
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED
(Session info: headless chrome=96.0.4664.110)
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.
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