i have a laravel project on my github. and i recently cloned to my pc but for some reason i got this error:
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
#php artisan package:discover
In Compiler.php line 36:
Please provide a valid cache path.
Script #php artisan package:discover handling the post-autoload-dump event
returned with error code 1
I created cache, sessions and framework folder inside storage folder but it does not work.
I also tried many things I read on forums and here on stack but nothing works with me.
i really don't know what's happening.
At first run: composer update
Create these folders under storage/framework:
sessions
views
cache
and run this below commands:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
Related
I wanted to free up the space stored in laravel.log under storage\logs. But when I did, it stopped working, and so I manually removed the laravel.log into the trash bin hoping that laravel would generate a new log file, but it didn't. So, I created a new laravel.log manually. I ran php artisan config:cache and php artisan view:clear to help solve this issue.
Without having to reinstall the whole thing, are there ways to fix this?
To resolve in Windows 10:
Navigate to your project directory, to storage\logs and create a file called laravel.log
Then run php artisan view:clear and php artisan config:cache
deleting storage/logs/laravel.log shouldn't create any issue, you can recreate the file by the name of laravel.log then add permission to the log file (in ubuntu) by running sudo chmod -R a+rwx /var/www/html/appplication-name/storage/logs and then run php artisan cache:clear, php artisan config:cache.
I pulled a repo with a Laravel app and tried
composer update
but it exits with
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 255
I found the following and regenerated the .env file and the key:
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 255
It did not help anything. I also got the original .env file from the server which also did not help.
Any idea what the problem could be?
ok now it works. What I did:
1.Created a fresh project with
laravel new test
2.Copied the composer.json from the not working project to my fresh project
3.did run:
composer update
(which did not have any problems in that fresh project, who knows why..)
4.did overwrite the vendor folder inside the not working project with the vendor folder from the fresh project after running composer update (see 3.)
5.did run:
php artisan key:generate
6.did run:
php artisan serve
7.app is running without any errors.
So, I'm trying to use Intervention Image with the Imagick driver.
I've done php artisan vendor:publish, and selected Intervention, and now config/image.php exists. I've changed 'driver' => 'gd' to 'driver' => 'imagick', but nothing at all happens.
I then tried php artisan config:cache, same thing.
Then composer dump-autoload, then php artisan cache:clear and any other combinations of the above.
I can put literally anything in this file, fill the array with invalid syntax, junk etc, and it's completely ignored.
Is there something I'm missing? I've tried everything I'm aware of.
Please delete cache folder from bootstrap folder and create new empty cache folder in bootstrap folder after run below command
php artisan config:cache
php artisan cache:clear
Please try with:
php artisan config:clear
The config:clear command is used to remove the configuration cache file created by the config:cache command. By default this command will delete the bootstrap/cache/config.php file.
I am getting below error when i run
php artisan passport:install
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "passport" namespace.
For installing laravel passport make sure you add this line to config/app.php in the providers array (package service providers section):
Laravel\Passport\PassportServiceProvider::class,
Then install the package and migrate the database
composer require laravel/passport
php artisan migrate
php artisan passport:install
Clearing out the cache is generally helpful first step when commands are not working, especially when you update anything in the config folder on .env files.
php artisan config:clear
php artisan config:cache
Config clear removes the configuration cache file. Config cache creates a new configuration cache file with the current settings. Config cache enables faster load times for your apps!
I got solution. After running following two commands every thing work fine.
run php artisan cache:clear
run php artisan config:cach
I was searching for a solution for this and I found simple one that worked for me:
Add these lines to $commands array in app/Console/Kernel.php
\Laravel\Passport\Console\InstallCommand::class,
\Laravel\Passport\Console\KeysCommand::class,
\Laravel\Passport\Console\ClientCommand::class,
Try running composer require laravel/passport "~9.0" before running php artisan passport:install
Just follow these steps:
composer require laravel/passport.
Once the installation finishes, add the following provider in the config/app.php file: Laravel\Passport\PassportServiceProvider::class,
php artisan migrate
php artisan passport:install
Here Is the solution of install Laravel passport with mongodb:
Just replace the Illuminate\Database\Eloquent\Model; with Jenssegers\Mongodb\Eloquent\Model in below files:
..\vendor\laravel\passport\src\Token.php,
..\vendor\laravel\passport\src\AuthCode.php
..\vendor\laravel\passport\src\Client.php
..\vendor\laravel\passport\src\PersonalAccessClient.php
and protected $table= "Table_name" variable with protected $collection="Table_name"
I just changed a constant inside my .env file. The new value is shown up correctly with php-cli (via tinker), but not in my web app (php-fpm).
So far I've tried everything as suggested:
sudo service nginx restart
sudo service php7.0-fpm restart
sudo service php7.0-fpm reload
.
php artisan config:cache
This will generate a cache config file in bootstrap/cache/config.php
php artisan config:clear
This will remove cache config file in bootstrap/cache/config.php
php artisan cache:clear
What exactly does does ? What type of cache does it clear?
php artisan clear-compiled
This clear compile classes
composer dump-autoload
This will generate/update composer autoload file.
I have some .env variables that are not part of any config file. So it is useless for me to run any of the artisan commands.
None of the above php artisan commands don't deal directly with $_ENV.
Seems that $_ENV is stored somewhere in the server and laravel cannot update it once properties are populated.
The only solution I've found is restarting the server.
I'm running a Laravel Forge instance.
If it is cached and you need to reload it you can simply use:
php artisan config:clear
This will pull in any changes that you have since made.
Try to delete the config on file on: Bootstrap/cache/config.php
AS well you can try: php artisan config:cache or php artisan cache:clear