I created laravel 7 project in my /home/namiq/projects/airblog folder.
After I finished my works I copied project files to /var/www/airblog folder in my pc. When I try to open web site it says
The stream or file "/home/namiq/projects/airblog/storage/logs/laravel-2020-07-18.log" could not be opened: failed to open stream: Permission denied
So what is the problem?
Why it points to old path?
How to change storage folder to point to new path?
Interesting. I usually deploy using git, that's why I always have to do a
composer install
once my files are on the server. Maybe that will help in your case, too?
Maybe also try a
composer dump
To generate new autoload files first.
Related
I'm new to Laravel and I have to develop on a project that already exists. But I am adding new features and I have to stage an environment to test. Thus, I chose the Cloudways platform. I upload my files using Filezilla but when I launch my website, I have the
ErrorException
file_put_contents(C:\wamp64\www\myapp\htdocs\storage\framework/sessions/l7OUJvDvv4UsvRPb7LNCIt8JNyVYRmE401P6zlKr):
failed to open stream: No such file or directory
The error is at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:135
I think it tries to create a new file with the path given. I know that the path that Cloudways is using is the one on my local environment. But I want it to access to the path on the server. I have read lots of forums but I don't find any answers...
My Laravel version is 7.30.6 and php version is 7.4.26
I've tried to reinstall Laravel and Composer and do the route:cache and views:cache
Also, I read on forums that the config/filesystems.php as to be like this:
but it's already the case.
Try php artisan config:clear and then upload the project via Filezilla
I found the solution. Inside the folder /storage/framework/sessions/FileSessionHandler, I had to modify the value of the $path variable.
I have successfully uploaded my symfony app to the server. I have also copied the content of the web folder into the public_html folder of my website. But when I access my app via the www.domain.com I get this error
Warning: require_once(/home/domain/public_html/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /home/domain/public_html/app.php on line 6
Fatal error: require_once(): Failed opening required '/home/domain/public_html/../app/bootstrap.php.cache' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/app.php on line 6
After researching I found that you can run composer install on the server but my challenge is that I dont know how to run cli command on the server via ssh/cpanel.
Please who will be kind enough to show me the way. This is my first attempt on trying to host a symfony application
When you don't run an composer install your dependencies are missing and the bootstrap.cache.php isn't created. So you have to upload the file and the complete vendor folder.
But i would prefer to take a look at your SSH connection and use the correct way. Otherwise you have to upload every time your complete sources including your vendor folder which can take a lot of time.
And the next think is your path. The components from your Symfony application are normally outside of your webroot. So you have to be sure that you can access that folders outside your webroot.
In some systems you have to allow that before you can use it. Otherwise you have to upload your complete application to your public_html folder and put your domain to the web subdirectory.
When I try to start Laravel artisan on a Command-line using php artisan serve, it works because I get the "Laravel development server started on http://localhost:8000/".
However, when I try to run 'localhost:8000' on my web browser, I get this error:
"Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:\xampp\htdocs\laravel\laravel/server.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0"
In your project folder, the server.php file is missing so you got this error
The solution will to create another project then copy the newly created server.php this will solve it.
Another Solution is:
Open the link: https://github.com/laravel/laravel/blob/master/server.php
Copy all code
Open Notepad and paste your copy code
save Notepad file and set name server.php
Copy the server.php file and paste it inside your Laravel project
Run your project again in browser Now you will not get an error and the Laravel project will work properly.
Try changing your port to 8080. Maybe some other app is already in charge of port 8000 aka port in use.
I also face that problem and after quite a time I become to solve it. it very simple to solve it.
When I copy an old project to new Laravel 5.6 setups. I face this problem.
so you should first install new laravel setup.
copy your previously created project. when you will use php artisan serve. you will see this type of error.
So it's mean in your project folder "server.php" file is missing.
copy this file from other project and paste it your project. it will run.
my problem like this which was I facing solve it by this method.
There are 2 ways to remove this.
FIRST WAY:
(1) copy the server.php from your project folder (
c:\xampp\htdocs\laravel\public\server.php)
NOTE: laravel is name of my project
(2) the file "server.php" which you have copied, paste this file to root folder (c:\xampp\htdocs\laravel)
SECOND WAY:
Trying add this file to root project folder https://github.com/laravel/laravel/blob/master/server.php
I had the same issue, but it was because of bad configuration file paths.php in Boostrap folder (Laravel 4.2).
This Line,
'public' => DIR.'/../public',
It seems the project i cloned had setup the the root of the project to be public, So i removed 'public' and become
'public' => DIR.'/..', and everything worked fine. I hope this will help somebody.
So i can conclude that, on top of missing server.php file as how others have been suggesting, also Public folder path misconfiguration in Bootstrap paths.php or app.php for higher Laravel can result into that error.
I had to setup a new server. During this process I copied my Cake app to the new system. By doing this the path changend from /data/nas/www/htdocs/adfund to /srv/www/htdocs/adfund. Now the app does not start anymore.
I tested console command Console/cake EmailQueue.sender and it came up with this error:
PHP Warning: include(/data/nas/www/htdocs/adfund/lib/Cake/Error/ErrorHandler.php): failed to open stream: No such file or directory in /srv/www/htdocs/adfund/lib/Cake/Core/App.php on line 548
To me this looks like some the app has stored the old path and tries to include from there.
Any idea where this could take place?
Old System: Eisfair
New System: OpenSUSE
You should completly wipe your cache directories. If there are still problems check your .htaccess file if RewriteBase is set wrong.
So I am using laravel 5.1 on ubuntu with nginx and php-fpm, I am having a little issue with my sessions. I have done all the permissions (chown to nginx/php user and group and chmod 777 on storage) however I think there is another issue.
The session file is created as I can see it on the server however when laravel is trying to write to it I don't think it can find the file see bellow:
at HandleExceptions->handleError('2', 'file_put_contents(/54dc94489b4c137d744f0427ce2c7e5e): failed to open stream: Permission denied',
Is there an issue with laravel finding the session path ? I am not really sure what to do, I have edited the filtsystem class and hard coded the path to the session directory however that isn't the correct solution.
I had to create 'storage/framework/views'