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).
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've been recently working on a laravel app and when I finished it, I decided to upload it to a server through FTP. I've set up all the proper folders in the storage/ directory and chmodded them to 777. ModRewrite is setup on the server, but I still get a 500 ISE without any log stack displayed in browser. I don't have access to Apache logs, so cannot check what's wrong. Please, could you give me some suggestions on what can be wrong and how to fix this? (The app was working absolutely fine on my local server on PC)
Finally got it working by executing:
php composer.phar dump-autoload
php composer.phar install
(The second one only generated optimized class loaders, because everything was installed earlier)
php artisan key:generate
Assuming permissions are right, I'd say it has to do with missing encryption key.
The exact error is the following
[Symfony\Component\Debug\Exception\ContextErrorException] Warning:copy(/Applications/MAMP/htdocs/Project/src/MR/UserBundle/Entity/User.php~): failed to open stream: Permission denied
on my Symfony3 command :
'php bin/console doctrine:generate:entities'
Does anyone ever had this warning ? or see what may cause the problem ?
I don't know if it's related to that, but I made a terrible mistake this morning, 'rm'ving my User directory (on OS X) with -R option.. a nightmare. I had to reinstall mysql, and did the same with MAMP. My symfony project was intact because of its location in the 'htdocs' directory.
I had the same problem with my var/ directory but solved it with this tutorial from the official website.
Hoping for a solve, because I cannot work on the project now..
Thanks in advance !
When Symfony generates entities, it makes a backup, and in your case the file it is backing up is called 'User.php~'. So for some reason when you run the command:
php bin/console doctrine:generate:entities
It doesn't have permission to write to that particular folder. Maybe do you have to use sudo? Or maybe you have to login as a different user? Regardless, it's a permission problem of writing the backup file.
By the way, the new file would be 'User.php', and the backup once the command completes is renamed 'User.php~'.
Hope this helps.
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 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.