enter image description herei'm using centos to host my laravel application,
when i upload the project first time using git, it will be cached, and when i change any file, changes doesn't apply, i tried all artisan commands that clear cache in laravel but didn't fix
the only way is to change the root directory of the application after each single change, is centos caching or nginx or laravel or other software in the server or the browser? even i cleared every thing in public/index.php and put echo 'foo'; and still got old cached data
screenshot of my nginx config file
screenshot of my nginx config file
This is possibly directory permission issue you need to grant storage and bootstrap directory 777 permission level. You need to run the following command on the root folder of your app
chmod -R 777 storage
and
chmod -R 777 bootstrap
Then try to effect your changes.
i tried systemctl restart php-fpm now every thing worked as expected and all changes applied thank you a lot i appreciate your help
I used 'composer update', which updated a few packages. During the updating process the website still functions. However, after it says 'The compiled services file has been removed', the website doesn't load and instead says:
Exception in ProviderRepository.php line 190:
The bootstrap/cache directory must be present and writable.
The weirdest thing is, when I run 'composer update' again, the website starts to work again, until the compiled services file is removed, at which point it throws the same error again. I have already tried the usual things that should be done when this error appears (chown -R everything to the right user/group and chmod all the files and folders 664 and 775 respectively).
I don't know what to do anymore, as the error doesn't seem 'correct'..
Try this after you have run the composer update:
php artisan cache:clear
On your Laravel directory file, run:
sudo chmod -R 777 bootstrap/cache/
The best way to resolve this error is:
Open your project folder
Move to the bootstrap directory
Create an empty folder named as cache
Then do PHP artisan cache:clear
This will work for sure
Short version: If uploading using something like AWS eb cli Verify if bootstrap/cache folder (not talking about its contents) is being deployed.
Some background behind my answer
I am using Amazon Web Services' Elastic Beanstalk to host my Laravel project. As I just started using Laravel I do not have much idea about its functioning. Two days back My new deployments were all crashing midway with OP's error message.
Earlier that day, I realised that I was not using
php artisan config:cache
to cache configurations to make things faster. And I added the same in composer.json's "post-install-cmd" and "post-update-cmd" clauses.
And I also added statement in .ebignore file to not upload the content of /bootstrap/cache (as its content is environment dependent a.k.a my localhost configurations have no meaning on my production server)
And facepalm I did not realise that this will stop the bootstrap/cache folder from being uploaded (as Like git, eb cli ignores empty folders).
So, when I started to deploy at night The deployments were meant to crash.
So, now I have just placed empty-placeholder (say) .gitkeep file in bootstrap/cache. And deployments are working once again :)
(Though the problem was so simple I realised the reason after ssh-ing and digging an EBS EC2 instance for some sweet sleep hours ~.~ )
For me, I manually created the cache folder inside bootstrap.
Try this too after you have run the composer update:
php artisan config:clear
Im using cmder on windows 10 in non elevated mode (Non-Admin).
command php artisan cache:clear did not work for me.
The folder bootstrap/cache did not exist.
I created the folder and removed readonly from both bootstrap and bootstrap/cache folder.
Both composer install and composer update are working now.
sudo chmod -R ug+rwx storage bootstrap/cache
hopefully, this will solve the problem.
it work for me run in project folder
sudo chmod -R 777 bootstrap/cache
than run
composer update
than run
cache:clear
First make sure bootstrap/cache dir is exist if not create a new one
mkdir -p bootstrap/cache/
Then run php artisan config:cache
Simple. There are applications that can block the directory. Like google drive synchronizer, One driver synchronizer, or any other application that is using windows explorer.
Delete cache folder. Create this again.
Try executing the following commands in your project root directory
composer update
then do
composer dumpautoload
this will avoid the necessity of messing with cache files
which may lead to whole new sort of issues
I don't imagine what I got done wrong with that before and no games around with that cashclearings had sense. But as it claims there was no 'cache' folder inside /bootstrapp . Had to have create it manually. Now it all rocks ok again
I had to create these five folders to be able to run artisan again.
mkdir bootstrap/cache
mkdir storage/framework
mkdir storage/framework/cache
mkdir storage/framework/views
mkdir storage/framework/sessions
Answer was found in this related question:
"Please provide a valid cache path" error in laravel
In my case, I've found out that the bootstrap/cache is missing in my project during a fresh clone.
Re-adding the cache directory manually solved my issue.
Then running composer install now works fine.
If a web server (e.g. Apache or Nginx) is being used as a front-end the solution is to make the directory bootstrap/cache owned by web server group. For Nginx:
$ sudo chgrp -R nginx bootstrap/cache
I have successfully installed Laravel project on the server but its not working. I am getting error like "page isn’t working
HTTP ERROR 500".
I have execute command
composer create-project --prefer-dist laravel/laravel
and created a directory name Laravel. But it's not working while same thing I have done on my local server and it's working fine.
in local you serve laravel project by internal web server using below command:
php artisan serve
but in your server env you must use apache conf and you must set document root like this:
your_project_directory/public/index.php
if every thing ok till now, your error must made by laravel error handling.
if so, then you can check your laravel log to find out exactly 500 error reason:
go to your project directory, then navigate to storage directory, here is logs directory and it has a laravel.log
tail -f your_project_directory/storage/logs/laravel.log
your generated log are here so read and solve it :)
tips: you must set privilages to your storage directory in server.
I run composer update and it resolve the problem. Known I run the following command from the root path of the application:
It was not the .htaccess file that was the problem nor the index.php. The problem was on accessing the files and requiring permissions.
For solving the problem i ran the following commands through terminal.
sudo chmod 755 -R laravel_blog
and then type below to allow laravel to write file to storage folder
chmod -R o+w laravel_blog/storage
This two commands solved the problem.
Please insert below command and try to access.
setenforce 0
it's working for me.
We have a Laravel app (version 4) that we're trying to deploy on AWS. Previously, it was hosted in our local servers via XAMPP. On AWS, I created a folder for the laravel app in var/www/html directory path. But as I try to access http://aws-url/laravel_folder/public, I get the error message:
Error in exception handler: The stream or file "/var/www/html/laravel_folder/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/laravel_folder/bootstrap/compiled.php:9134
I've checkout all similar questions and have followed the suggestions, i.e. setting permission of laravel.log to 777, but still keep getting the same problem.
How do I fix this problem?
Thank you
First 777 permission is not a good idea.
If you're on linux, use the following command:
chmod -R 770 logs (add sudo in front if you're not the owner of the folder!)
That will give owner and group read-write-execute permission on the logs folder and everything inside it but will give no permission to other users.
Also make sure that the folder and files inside it have the web server's user as group.
Hope that's help!
You need to set the permissions for the entire storage folder to 777
sudo chmod -R 777 storage/
I've got an error in a Laravel instance, which says:
[2016-11-08 16:48:19] prod.ERROR: ErrorException:
file_put_contents(/theLaravelSite/bootstrap/cache/services.php):
failed to open stream: Permission denied in
/theLaravelSite/bootstrap/cache/compiled.php:7327
I've seen these errors before, which relate to the storage folder, but I'm a bit confused by this one, since it seems to say that it tries to write content to bootstrap/cache/services.php.
Any idea how I can solve this?
Change the directory permissions to:
chmod -R 775 storage/
chmod -R 775 bootstrap/cache/
According to Laravel Docs
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
You should set correct permissions on bootstrap folder recursively:
chmod -R 775 bootstrap
Also, check if bootstrap/cache exists. If it doesn't exist, create it manually.