Laravel Http Client events not firing from terminal - laravel

I created a subscriber that listen to Http Client events (ConnectionFailed, ResponseReceived) to log all http requests. It works fine when I make a request in controller, but when I make a request in tinker or in a command, nothing will log.
Do you have any idea what's the problem?
But it works in a fresh Laravel.
I tried chmod -R 777 storage/logs
Adding
public function shouldDiscoverEvents()
{
return true;
}
to EventServiceProvider.
Adding APP_LOG_LEVEL=debug to .env
Also
sudo rm -rf storage/framework/cache/data/*
sudo rm -rf bootstrap/cache/*
composer dump-autoload
php artisan clear
php artisan debugbar:clear
php artisan cache:clear
php artisan auth:clear-resets
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:forget spatie.permission.cache

In my case the imanghafoori/laravel-microscope package caused this issue.
I created an issue: https://github.com/imanghafoori1/laravel-microscope/issues/161

Related

Laravel8 storage files not found

php artisan storage:link
local worked fine.
After deployment without start php artisan serve it doesnt find the files in storage.
Symlink is online.
ok if I make symlink on my own it worked fine.
use
ln -s ../storage/app/public storage
instead of
php artisan storage:link
If you have access to ssh or to the remote terminal:
php artisan storage:link
php artisan config:clear

There is no existing directory at /storage/logs and its not buildable: Permission denied

I have a problem with my Laravel deployment on a OVH web server.
After made
composer update
php artisan cache:clear
php artisan route:clear
php artisan dump-autoload
I have this answer:
There is no existing directory at /storage/logs and its not buildable: Permission denied
I put all the files on 777 chmod but I have always this answer.
Please try the following commands
php artisan route:clear
php artisan config:clear
php artisan cache:clear
Note: In case you are a Homestead & VirtualBox user, please be sure that your VirtualBox is up to date.
It helped in this thread at laracasts
Clear the cache and config, then deploy to the live server.
If you've already uploaded to the live server, then you have to follow these steps:
Delete bootstrap/cache/config.php
Delete all log files in storage/logs.
You don't need to add any permission on the storage file.
The main problem here is in the compiled file, and due to which laravel try to show an error.
By default in laravel, storage file not having permission to show in the console (error
shows from the error.log file).
So the thing you need to fix is to fix compile file. which can be done thought this single command
Use this
php artisan optimize:clear
This command will clear all your cache
Compiled views
Application cache
Route cache
Configuration cache
After changing local conf i got the same error over and over,
try this, probably will help.
rm bootstrap/cache/config.php
and then
php artisan cache:clear
depending on your scenario, reloading auto-loader file can solve your issue, for that use :
composer dump-autoload
or sometimes just try :
composer install
this do the two the commands listed above.
go to your vagrant
then run
vagrant ssh
php artisan config:cache
Run the following command if you can access your server terminal
php artisan route:clear && php artisan cache:clear && php artisan config:clear && php artisan config:cache
If you are on shared hosting and cant access the terminal go to your web route file in routes/web.php and make a temporary link such as shown:
Route::get('reset', function (){
Artisan::call('route:clear');
Artisan::call('cache:clear');
Artisan::call('config:clear');
Artisan::call('config:cache');
});
Then go to http://your-domain/reset to execute the commands. there after you can now access your website as normal
If you are using homestead (vagrant) in Laravel then follow the steps #Farid shahidi provided
vagrant ssh
cd /home/vagrant/code <-- your file usually resides here; see your Homestead.yaml configuration
php artisan config:cache
You Have to try artisan command in this way
php artisan cache: clear
php artisan config:cache
php artisan cache: clear
This one-line command solves my issue:
php artisan config:cache
Delete bootstrap/cache/config.php from your laravel deployment on the server.
Please run the below commands:
php artisan route:clear
php artisan config:clear
php artisan cache:clear
This one worked for me in case your project is located within /var/www/html/
sudo chmod -Rf 0777 /var/www/html/{project-name}/bootstrap/cache
sudo chmod -Rf 0777 /var/www/html/{project-name}/storage
You need to run this command from the terminal.
php artisan config:clear
php artisan config:cache
I got the same issue, I change the permissions of the folders inside the the storage folder.
chmod 777 <folder_name>
I'm not sure about this security wise. but this resolve my problem.
I change my file settings to 755 also work for me.
try this
remove your "vendor" folder
Run "composer install" or "composer install --ignore-platform-reqs" on your cmd or terminal
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan config:cache
if you are using linux:
service apache2 restart (just in case)
if you using xammp:
just restart your xammp
For those of you using sail, do:
sail artisan optimize:clear

Laravel - Error page is blank after update from 5.3 to 5.4

I have updated Laravel from 5.3 to 5.4. Error pages are white and do not display an error after update. I am using a local server. The specifications:
OS: Ubuntu 16.04
Nginx/1.9.15
PHP 5.6.11
I read the this question (Laravel blank white screen) and I have tried solutions:
# Group Writable (Group, User Writable)
$ sudo chmod -R gu+w storage
# World-writable (Group, User, Other Writable)
$ sudo chmod -R guo+w storage
And other solutions have been proposed. But the problem persists!
Also, Application debuggin in .env and config/app.php is true.
Who can help?
After update your laravel you may clear all your cache and your compiled page. Try to do this:
php artisan view:clear
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan clear-compiled
php artisan optimize

Laravel working in master branch but not updating HTML in localhost

I'm working in my master branch on my computer locally. I've updated some HTML and I'm loading the page up in localhost. However, the HTML is not being updated but my CSS is, what do I do? I haven't had this problem before!
Try
php atrisan config:cache
on your terminal. May be the page serving from cache that's why not reflecting the changes.
Try to execute this commands to remove the caches:
php artisan clear-compiled
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
composer dump-autoload
php artisan optimize

Reload .env constants in Laravel 5.2

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

Resources