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.
Related
So , I am working on a small project where I need to create a symlink to store file in the storage directory in laravel. I was previously working on windows where the same code was working fine but as I configured Laravel Sail and set it up in my WSL-2 environment, I performed my ritualistic tasks of setting up the config, creating symbolic link, I am noticing a weird behavior of running the php artisan storage:link command where it creates a file instead of a folder in my app/public folder.
It should be a clickable folder or if not clickable, atleast my IDE should show it as a directory like that of others, i.e. like public, bootstrap, database folders. Is that a problem with my WSL or some internal configuration of Laravel. On double clicking this link it shows:
Any assistance will be greatly appreciated.
If you created it in wsl2, windows won't regonize it as a symlink, it's a unix symlink and not a windows "symlink" that's all.
In WSL you're working inside a unix based filesystem and sharing your filesystem with windows.
Its because your file its just accessible in the docker container created by sail. You cant access to it like this.
note: this is not an error or missing. it is just a behavior
In my case the happened in Ubuntu since I had to connect my storage/app/public folder to public/storage. at first glance, I was confused, and seemed to be an error but with some more try and fail it was correct as it is. the problem was, in Windows all our files existed in a symlink to the public/storage folder and from there we could delete and manipulate the file but after creating the file symlink all files are only visible in storage/app/public directory but can access from public/storage folder from the web easily.
As a work around, created folder manually and run the command.
sail php artisan storage:link.
It will link
I have a file stored in storage directory in Laravel 7. The sub directory is storage/app/public/personnel-docs/nameofile.ext.
I have done php artisan storage:link and therefore, on my local which is a windows 10 machine I can access it by the following url
http://127.0.0.1:8000/storage/personnel-docs/nameofthefile.ext
But where it is hosted on a LIVE linux server, when I try the same url as follo
http://theliveurl/storage/personnel-docs/nameofthefile.ext
It returns a 404 Not found response.
I have also run php artisan storage:link on the server and the problem persists.
I have checked and confirmed that the file is present on the folder but it just does not return/display as expected.
I will appreciate any effort to resolve this.
Thank you
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.
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'm using Laravel 4 and am trying out queues with Beanstalkd (running on Homestead locally)
I have a script which downloads and parses an XML file which is working fine with the sync driver but when I switch to the beanstalkd driver I get a failed to open stream: No such file or directory error on the copy() function.
Is there any configuration that I might be overlooking with file downloading via Beanstalkd? I get the same error whether I'm trying to copy() a URL or a local file so I assume it's not network related. I also tried fopen() but get the same error. It works fine however for simple tasks such as Log::info('This works.');
Thanks
I had the same problem when running Artisan tasks... the problem was with the file paths. Laravel was automatically resolving paths to the public directory but Beanstalkd & Artisan were not. Adding public_path() before '/folder/file.txt' solved the issue.