When I try to run a symfony console php command (generate:bundle, etc) in cygwin, I get an error similar to:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: file_get_contents(E:/xampp/htdocs/foo_com/app/config/parameters.yml): failed to open stream: No such file or directory in /cygdrive/e/xampp/htdocs/foo_com/vendor/symfony/symfony/src/Symfony/Component/Yaml/Yaml.php line 61
If I delete the app/cache folder, I can run the app/console commands without any issues, until I access my page in the browser. Once I access my page in the browser I start to get this error again.
Try to do the following:
(assuming that you run windows 7):
run cygwin\bin\dash.exe as administrator
/usr/bin/rebaseall -v
run cygwin.bat as administrator
In my case it solved this problem.
Related
I used Laravel in Visual Studio code, and when I opened localhost:http://127.0.0.1:8000/ bypassing command php artisan serve, I got an error.
So I used another command php -S localhost:8888 -t public, I used this 8888 localhost. But I can't understand why localhost:http://127.0.0.1:8000 is not working.
This is an image of a browser:
you need to go at your laravel project path and run cmd after that run this command.
Another solution is here
php - Unknown: Failed opening required on line 0. laravel 5.6
I trying to learn laravel and I am attempting to set it up on my server.
I have meticulously followed all the instructions in this tutorial while changing some variables based on the names of my own directories:
http://davidmyers.name/post/laravel-on-digital-ocean
The 500 error only is thrown when I visit the laravel project's public folder. When I attempt to visit any other page such as PHPMyAdmin or any other PHP or HTML page, the page pulls up just fine.
Is there anything I could be missing that is not included in the tutorial that I referenced? I double checked that I am following all the steps correctly.
Also, running composer update in the directory throws this error:
[RuntimeException]
Error Output: PHP Warning: require(/var/www/html/testproj/bootstrap/../vendor/autoload.php): failed to open stream: No
such file or directory in /var/www/html/testproj/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/html/testproj/bootstrap/../vendor/autoload.php' (include
_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/testproj/bootstrap/autoload.php on line 17
I found this related stackoverflow article:
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
but the solution did not work for me, since my phpinfo() shows that OpenSSL is enabled.
The problem is that the server does not have access to those locations.
Run the following commands
sudo chmod 755 -R "your project name"
and then
chmod -R o+w "your project name" /storage
if it still doesn't work try running:
sudo chmod 775-R "your project name"
sudo chmod 775-R "your project name"/storage
or
sudo chmod 777-R "your project name"
sudo chmod 777-R "your project name"/storage
Have you run composer install ? This should automatically run php artisan optimize after install, which I believe is the command to create the file in question.
You must install dependencies by composer using:
composer install
and then give right permission to storage directory:
chmod 777 -R storage
or
sudo chmod 777 -R storage
It turns out that I was doing everything right, but when I went to run composer install I didn't see that it was throwing an installation error due to my server not having enough memory. Increasing my server's memory fixed the problem.
There are 2 things to consider,
1. Web server throwing 500 error (as if text and font were from Chrome) or
2. The application is showing 500 error (with beautiful image and text)
Case 1: you probably need to install composer
sudo composer install
Case 2: Check appropriate permission on storage/ (as suggested on other answers) and check if you have .env file. if not copy .env.example and rename to .env and you also need to generate application key.
sudo php artisan key:generate
PS: You may be in this situation mostly if you have used git to deploy your code on server and your development machine is different. This answer is based on the scenario which I faced and how it was solved.
I am trying to run a Symfony2 project on my local server after downloading it from the FTP. I keep getting this error when running the server:
Warning: require(app_dev.php): failed to open stream: No such file or
directory in
/Users/bogdan/Sites/httpdocs/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php
on line 36
I am running everything on developer mode.
I would suggest to read http://symfony.com/doc/current/book/installation.html firstly.
Anyway I think that you run console from a bad path. You have to run app/console server:run. It means that you have to be in a root directory of your project.
cd my_symfony2_project
php app/console server:run
I've never had a problem with either Symfony2 or Vagrant before this point and I'm absolutely lost as to what is happening.
Without any warning my environment died completely and will only produce the following error:
ContextErrorException: Warning:
file_get_contents(/Users/Paul/Sites/Project/htdocs/project-web/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig):
failed to open stream: No such file or directory in /var/www/project-web/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 130
The reason this is strange is that Symfony is referring to my local file system...
/Users/Paul/Sites/Project/htdocs/project-web/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig
....instead of the box environement which is running Ubuntu, then referring to the unix filesystem location of 'Filesystem.php'...
/var/www/project-web/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
I cannot get past this screen. I have just created a brand new environment and packaged it as a its own box, then using that box I still get this error.
Can anyone help?
My first guess is you have run it locally first and the paths are in the cache. If so it should be fixed by running the following in your vagrant environment:
php app/console cache:clear
Add --env=prod if you are running the app.php rather then app_dev.php.
Always use the command line IN your vagrant box (via ssh), never cmd on the windows path.
vagrant up
vagrant ssh
... some auth ...
cd /your/project/path
php app/console ...
I'm using Homestead with Symfony 3.1.
I had to delete var/cache folder from the root of my project in the host machine.
rm -rf var/cache/ solved it.
Before, I tried out php app/console cache:clear with no results.
I've made a symfony2 app and I try to deploy it on a shared server, but I get a fatal error.
I've taken the recommended steps here: Deployment-Tools
I've updated the vendor dependencies:
php composer.phar install --optimize-autoloader
I've cleared the cache:
php app/console cache:clear --env=prod --no-debug
I've change the permissions on the server for app/cache and app/logs
But it doesn't work. This is the error:
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/cookieboy/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:71
Stack trace:
#0 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php(58): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(101): Monolog\Handler\AbstractHandler->handleBatch(Array)
#3 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Logger.php(239): Monolog\Handler\FingersCrossedHandler->handle(Array)
#4 /homepages/32/d453730371/htdocs/cookieboy/vendor/mo in /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 71
and I was wondering why symfony tries to open this file /var/www/cookieboy/app/logs/prod.log) which is located at locahost and It has nothing to do with the production server.
Any idea about that issue?
I have solved the issue by deleting manually all the content inside app/cache. I don't know why but the command php app/console cache:clear --env=prod --no-debug didn't make its job in the way I was expecting.
Thank you all for the answers.
Did you set up permissions?
$ sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
If you don't have access to changing the ACL of the directories, you will need to change the umask so that the cache and log directories will be group-writable or world-writable (depending if the web server user and the command line user are in the same group or not). To achieve this, put the following line at the beginning of the app/console, web/app.php and web/app_dev.php files:
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777
In any way i recommend you to use capifony for deploy. once you setup it. you'll forget about deployment troubles.
If you open app_dev.php in your favourite text editor you will notice that one line which contain array of ip allowed to access dev envoiromnent. It's commented.
You may edit this file locally and then upload via ftp. Just be sure you will put there your correc public ip. Then you will be able to access dev enveironment while connecting from this ip. It will also allow you to run app_dev.php on your remote host just like you did on your localhost.
Besides you will be able to get more debug informations. It's obviously security lack and shoud never happen in serious application but is really common while learning symfony and missing ssh.
In similar way you may run config.php on your server.
(Please notice in this case everyone connecting from this ip will be able to get access to dev environment.)