Symfony2 project on local server - php

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

Related

Laravel shows error in "localhost:http://127.0.0.1:8000/"

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

Laravel file_put_contents() error

I have a website which works locally (through VM), but when I upload it to the server I get this error
ErrorException in Filesystem.php line 111:
file_put_contents(/home/vagrant/Code/xxxx/storage/framework/sessions
/Ec2ceBoBBnKIOx8SzMXOf4akbzA5g5aI9WHBEhn6):
failed to open stream: No such file or directory
Things I've tried that didn't help: running composer update, running dump-autoload, running cache:clear, running config:cache, deleting everything on server and re-uploading everything after, creating directory/file manually, setting permissions to 777.
Any insights?

Laravel Digital Ocean Error in exception handler

I have followed through the phpacademy digital ocean tutorial in order to try and get my laravel site set up. After following through the steps there was a difference between my setup and theirs. My default index.html page was located at /var/www/html instead of /var/www
I removed the index.html page and uploaded my laravel app. I am not using any DB connections (just using static content). I developed my site locally with vagrant and homestead.
After uploading the app and going to the IP address I get the Laravel app directory listing. When I went into public I got a message saying mcrypt was require/not installed. I installed it with sudo php5enmod mcrypt and restarted the server.
Again I reloaded the page and I get the following message (after turning debugging to true) "Error in exception handler: The stream or file
"/var/www/html/app/storage/logs/laravel.log" could not be opened:
failed to open stream: Permission denied in
/var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84"
How do I fix this and can i remove the /public and just use straight IP / domain (once i get that far)
Error message indicates it can't open your log file there. Assuming you're using this tutorial (https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-nginx-on-an-ubuntu-12-04-lts-vps), take a look at the subsection "Fixing Permissions", you'll need to chmod your storage directory.
chmod -R 775 /var/www/laravel/app/storage
Start artisan with sudo. This will give artisan all the permissions it needs and won't make any security troubles as well.
so instead starting artisan serve with:
$ php artisan serve
try using:
$ sudo php artisan serve
thus you wont have to make any permission changes

Vagrant + Symfony2 Environment ContextErrorException Weirdness

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.

symfony2 cygwin cli php commands error

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.

Categories