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.
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.
When I create a new Laravel 5.6 website and use php artisan serve in the console the website loads in the browser, but when I refresh the page the server.php file deletes itself and I get a page error.
Below is an image of the error message:
This is the text of the 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\test3\server.php' (include_path='C:\xampp\php\PEAR')
in Unknown on line 0
server.php file is missing so you got this error, Some antivirus considers that the server.php file is a virus, So he simply removes it.
You can also manually create server.php file
Open the link and copy all the code: https://github.com/laravel/laravel/blob/master/server.php
save in 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 your Laravel project will work properly.
You need to update both composer and laravel installer. This happens maybe you have latest composer version but outdated laravel installer. To do this, run composer update then composer global require "laravel/installer" to update laravel installer as well.
Lastly check the server requirement for your laravel version. Laravel 5.6 requires at least PHP >= 7.1.3. So make sure you have that in your serve. If not then you probably need to update it.
After the updates, try to install laravel again.
EDIT: I confirmed the issue, it seems a bug in laravel installer
The solution will to create another project then copy the newly created server.php this will solve it.
Also if your anti-virus is avast, you need to add exception there, I have a response in GitHub that avast considers it as a threat.
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.
I'm setting up a demo site for a Wordpress plugin on Heroku. My plugin uses composer to manage dependencies, and it's configured as a git submodule on my local installation. I push to heroku and everything seems to work. I use heroku run bash to ssh into the app and manually run composer install from inside my plugin. Then I log into the site and try to activate my plugin... but I get the following error:
Plugin could not be activated because it triggered a fatal error.
Warning: require_once(/app/wp-content/plugins/wp-github-pipeline/vendor/autoload.php): failed to open stream: No such file or directory in /app/wp-content/plugins/wp-github-pipeline/wp-github-pipeline.php on line 23 Fatal error: require_once(): Failed opening required '/app/wp-content/plugins/wp-github-pipeline/vendor/autoload.php' (include_path='.:/app/.heroku/php/lib/php') in /app/wp-content/plugins/wp-github-pipeline/wp-github-pipeline.php on line 23
I don't get it. With heroku run bash I can see that the file is actually there. And I don't get this issue locally or on another remote server. Why is it happening here?
I can't say for sure why this worked but it appears that Heroku doesn't really play nicely with composer.json somewhere other than the project root. So I took my project's composer.json and moved it to the project root, then I added...
"config": {
"vendor-dir": "wp-content/plugins/wp-github-pipeline/vendor"
}
...which caused the dependancies I needed (and the autoload.php) to get installed in the original location.
With this, I am able to push to Heroku normally without issues.
I have NO idea why I was able to run composer install manually without it working. I also have NO idea why heroku run bash would show me files that aren't actually there.
According to me you have to regenerate the autoload. Hope that you have written code within composer.json for autoloads.
composer dump-autoload
This will regenerate your autoload and it will solve your problem. If not please modify your question by pasting your composer.json.
What I did to solve this was add an include_path to my .user.ini file. That ini file needs to be located in the document root, not the app's root.
include_path = ".:/app/.heroku/php/lib/php:/app/vendor/"
Don't copy my include_path example verbatim, as it might now be the needed include path for your app. Get your current include path from Heroku's error log, and then append :/app/vendor to it.
What's important there is adding /app/vendor/ to the include_path. That will point yourrequire php statement to the spot where Heroku puts the autoload.php.
I am trying to upload my project on the distant server, I simply uploaded the files on the distant server, checked the config.php, which says that all is good. I have removed the if conditions for only local access. But when i try to open the app_dev.php or app.php i keep getting this error
ContextErrorException: Warning:
file_get_contents(C:\wamp2\www\Symfony\src\Les\CouvertsBundle/Resources/views/Couverts/index.html.twig)
: failed to open stream: No such file or directory
in /homepages/26/d367595533/htdocs/Symfony/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 130
i have not found any answers to this question, maybe not looking for it properly. But could anyone explain to me why would this error is occuring? Why is symfony looking for the files with the local address?
I followed this tutorial to deploy project in production http://fr.openclassrooms.com/informatique/cours/developpez-votre-site-web-avec-le-framework-symfony2/deployer-son-site-symfony2-en-production. The steps seem pretty straight forward, but maybe i am missing something.
This is really frustrating, because my project is ready but i can't seem to put it online due to this problem.
The problem seemed to be the command php app/console cache:clear and php app/console cache:clear --env=prod didn't completely clear the cache folder.
It can happen if the user running the command hasn't the permission to delete files/folder in app/cache/ Manually removing the content of this folder can solve the issue (rm -rf app/cache/*).
Just clearing the cache manually at (projectname/app/cache) instead of the command line worked for me (version 2.8).