$ cd /var/www/tests/php/symfony/sf4/the_spacebar $ php -S 127.0.0.1:8000 public PHP 7.2.3-1+ubuntu16.04.1+deb.sury.org+1 Development Server started at Sat Mar 17 23:13:26 2018 Listening on http://127.0.0.1:8000 Document root is /var/www/tests/php/symfony/sf4/the_spacebar Press Ctrl-C to quit. [Sat Mar 17 23:13:37 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 [Sat Mar 17 23:13:37 2018] PHP Fatal error: Unknown: Failed opening required 'public' (include_path='.:/usr/share/php') in Unknown on line 0
I got this error running my browser to the 127.0.0.1:8000 url (it's a blank page). I check the permissions, the directories in vendor/, everything seems good, but... not enough to work. Why did the video run the server so easily, and not me ?
Hi! I have PhpStorm 2019.3 and Symfony 5. I use build-in server (https://127.0.0.1:8000/) and Symfony Support plugin is not working correct - Symfony Profiler is empty, and no templates exist for creating Controller (but exist for Services/Yaml|XML). How can I fix templates and profiler?
Which distribution of Symfony did you install? It seems to me that you installed the "skeleton" distribution. If what you want is a website application, you should start with the "website-skeleton" distribution, the only difference between distributions is that one comes with more packages than the other one. Check it by yourself:
I am not sure why but for this Symfony 4 course if I set .env file to production such as
APP_ENV=prod
- it will stop working and displayed error below, can you please tell me why? Thank you!
Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
I would like to be able set it to production mode, because I have coded in with my custom codes.
Make sure you clear the cache before access the page in browser. In prod environment files are not re-compiled automatically. So, try to run: $ bin/console cache:clear --env=prod
first and then refresh the page. Does it help? If not - check "var/log/prod.log" file for more context about the error :)
Please, keep in mind that you may have 2 php.ini: for CLI and for PHP-FPM. So, where to do changes - depends on what you're using. Also, you need to restart PHP-FPM and re-start the local web server to apply changes. Do you hit this error when executing "bin/console cache:clear"? If so, it's weird... but you can try to clear the cache manually, in your terminal just do "rm -rf var/cache/dev" or any other environment for what you want to clear the cache.
Ok, the Error message is kinda misleading, this article helped me figure it out https://github.com/Seldaek/... that permission for apache to write to var/log/prod.log dir was not there. Not sure why but I already gave group www-data rwx permission. So i ran command
Thank you for sharing this tip with others! Well, I'm not confident with this command, I mostly do things like "chown", but if it works for you - great! I'm far from Linux expert :) And yeah, permissions might be tricky sometimes :/
Sorry and please ignore all of my comments above, i was so confused by many things. The actual issue with this is because I left a dump statement in twig template hence it will load with error 500 in PROD environment! This took me down to rabbit hole. All is fixed now.
Bonjour I follow the course but I can' t install symfony 4 . It's Symfony 5 that it installed. Can I follow all courses with symfony 5 ? What I have to do to force composer to install symfony 4 ? ^4 to install symfony 4 generate an error.
Ah, probably "^" symbol is a special for your terminal. I wonder what OS do you use? Because yours command does not work for my terminal, and I'm on Mac. I suppoose if you wrap the package name and its version with quotes - it shoudl fix the problem. Please, could you confirm that this command also work for you?
Thank you for your reply! Hm, that's weird... it just should work. What if you wrap package name with version constraint in double quotes instead? Like: $ composer create-project "symfony/skeleton:^4" the_spacebar
Does it help? Or probably it might also depend on your Composer version. What exactly version do you have?
Ha, nice! Thank you checking it! Then, if double quotes works for you - I'll tweak the command to use package name in double quotes, it should prevent failures for more people :)
Sadly, you cannot follow this tutorials by using Symfony5, it's still pretty new and the real problem are the dependencies, many of them haven't added support for Sf5.
If you are using Symfony CLI you can pass the option --version=4.4 to install version 4.4 or pass any other version you want to use
Actually, I cannot do the lessons with symfony 5. I installed symfony 4.0 but I could not do the course. thanks, I installed symfony 4.4 and it's ok for me.
We're sorry about it! Yes, we do use Vimeo for hosting our videos, but unfortunately nothing much we can do here to make it non-blocked for your country. Probably some VPN could help you to get access to it.
cannot play the video, tried to download but unsuccessful "Firefox can’t establish a connection to the server at player.vimeo.com." I have good internet connection
Hi I am on the different laptop and account and the result is still the same error with following message "This is a modal window.The media could not be loaded, either because the server or network failed or because the format is not supported."
We're sorry about it! But unfortunately nothing much we can do to unblock Vimeo in your country. I can only suggest to try some VPN servers that may bypass the blocking.
Otherwise, we do want to make our coruses accessible to everyone, that's why we have scripts below each video with exactly what we're saying in the video. Also, those scripts include dynamic expandable code blocks of the exactly what we're coding in the videos. So you can still continue reading and coding with us.
Seems like I always have to do things the hard way. I followed the tutorial and on my dev server that already has a running web server. I ran the composer create-project symfony/skeleton the_spacebar. When I went to https://my.serverurl.com/de.... I got a shock that it just listed the files in the directory. A huge red flag. Something is wrong. So, I opened the .env file instinctively. PHPStorm placed the red squiggly line under the file so I know more stuff is wrong. I tried to find how to setup symfony on an existing web server. Found way to much stuff that don't answer my question about the .env file config. I did run the suggested Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). Still see directory list. I changed all the # to /. Still no joy and added TRUSTED_HOSTS='^localhost|my.url\.com$'. How do I fix this to run properly?
Sure, for a real web server you need some more configuration to spin up the website. Symfony has exmple configuration for both most popular web servers: Apache and Nginx, see this doc about it: https://symfony.com/doc/cur...
I don't know what exactly web server you have, but here's a little hint for you in case you're using Apache: Install this https://github.com/symfony/... that will execute its recipe and copy/paste the .htaccess file into your public directory: https://github.com/symfony/...
Video 1 post project build is incorrect (obsolete) After the initial project build... The screen shows
What's next?
* Run your application: 1. Go to the project directory 2. Create your code repository with the git init command 3. Download the Symfony CLI at https://symfony.com/download to install a development web server
Could you clarify what exactly is incorrect on your opinion? This message comes from Symfony, and it depends on the version of Symfony. If you upgrade the project dependencies - the message might be a slightly different.
hey! i have a problem when i create a empty project, when i come to the welcome page,it's ok,the web show me,but the log tell me there is a error "Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /" (from "http://127.0.0.1:8000/_profiler/14e990?panel=logger")" at /my-project/vendor/symfony/http-kernel/EventListener/RouterListener.php line 139" i try lots of ways to solve it,but still error,i am new in symfony,could u help me? thank you so much
Ah, that's OK. Well, if you see the default " Welcome to Symfony" page - that's OK. It means it's the default temporary page from Symfony to get you started, but in your project there's no any route that handles "/" URL. So, when you create a route for "/" - Symfony will automatically renders *your* page instead of this default one. So, just go further in this tutorial and create a new controller for your custom homepage ;)
Can you tell me, which terminal are you using? I started using xampp shell, but for instance, can stop the server with ctrl c, and I had to close some windows and open new ones. I would like to use, the one you are using.
In the video Ryan uses iTerm2 on his Mac. I suppose you're on Windows, so, you can take a look at Git Bash, or probably a popular https://github.com/cmderdev... .
To upgrade Symfony with its dependencies - first of all you need to change version constraint for symfony/symfony in composer.json and then run "composer update". And you also need to look inside UPGRADE manuals that you can find in symfony repo: https://github.com/symfony/... - for example, here's what you need to do to upgrade from Symfony 4.1 to 4.2: https://github.com/symfony/... . Btw, we have a few tutorials where we show how to upgrade Symfony properly, you can take a look at: https://symfonycasts.com/sc... https://symfonycasts.com/sc...
P.S. Also, keep in mind that new Symfony 4 requires PHP 7.1.3, if you have a lower version of your PHP - you won't be able to upgrade, upgrade your PHP first.
When I run the command "composer create-project symfony/skeleton name_of_project" it installs version 3.4.20. How is this possible and how can I upgrade to symfony 4?
Best regards, Dennis
P.S. I did run composer self-update before installing the project.
72 Comments
Hi there,
I have this issue :
$ cd /var/www/tests/php/symfony/sf4/the_spacebar
$ php -S 127.0.0.1:8000 public
PHP 7.2.3-1+ubuntu16.04.1+deb.sury.org+1 Development Server started at Sat Mar 17 23:13:26 2018
Listening on http://127.0.0.1:8000
Document root is /var/www/tests/php/symfony/sf4/the_spacebar
Press Ctrl-C to quit.
[Sat Mar 17 23:13:37 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Sat Mar 17 23:13:37 2018] PHP Fatal error: Unknown: Failed opening required 'public' (include_path='.:/usr/share/php') in Unknown on line 0
I got this error running my browser to the 127.0.0.1:8000 url (it's a blank page).
I check the permissions, the directories in vendor/, everything seems good, but... not enough to work. Why did the video run the server so easily, and not me ?
Old thread but for new users stumble across this , it should be
`$ php -S 127.0.0.1:8000 -t public`
Switch `-t` is missing in above comment.
Hey Raman,
Ah, really, good catch! The "-t" option is missing :)
And thank you for pointing about it in such an old thread!
Cheers!
hello;
how come when I run $ git status, i get this message "fatal: not a git repository (or any of the parent directories): .git"
thank you
Hey Hicham A.
That happens when you haven't initialized GIT in your project. Just run
git initand follow the steps :)Cheers!
Hi!
I have PhpStorm 2019.3 and Symfony 5. I use build-in server (https://127.0.0.1:8000/) and Symfony Support plugin is not working correct - Symfony Profiler is empty, and no templates exist for creating Controller (but exist for Services/Yaml|XML).
How can I fix templates and profiler?
Hey Iryna
Which distribution of Symfony did you install? It seems to me that you installed the "skeleton" distribution. If what you want is a website application, you should start with the "website-skeleton" distribution, the only difference between distributions is that one comes with more packages than the other one. Check it by yourself:
Anyway, if you want the Profiler component, you will have to install it by running
composer require profilerI hope it helps. Cheers!
Hello,
I am not sure why but for this Symfony 4 course if I set .env file to production such as
- it will stop working and displayed error below, can you please tell me why? Thank you!
I would like to be able set it to production mode, because I have coded in with my custom codes.
Best regards,
Hey Dung,
Make sure you clear the cache before access the page in browser. In prod environment files are not re-compiled automatically. So, try to run:
$ bin/console cache:clear --env=prod
first and then refresh the page. Does it help? If not - check "var/log/prod.log" file for more context about the error :)
Cheers!
Interesting I ran into
in log /var/log/apache2/error.log
To give the max I set in php.ini
I still get the same error. I will keep digging. Please let me know if you have any advice.
Thanks Victor!
Hey Dung,
Please, keep in mind that you may have 2 php.ini: for CLI and for PHP-FPM. So, where to do changes - depends on what you're using. Also, you need to restart PHP-FPM and re-start the local web server to apply changes. Do you hit this error when executing "bin/console cache:clear"? If so, it's weird... but you can try to clear the cache manually, in your terminal just do "rm -rf var/cache/dev" or any other environment for what you want to clear the cache.
Cheers!
Ok, the Error message is kinda misleading, this article helped me figure it out https://github.com/Seldaek/... that permission for apache to write to var/log/prod.log dir was not there. Not sure why but I already gave group www-data rwx permission. So i ran command
that fixed the issue, now all is working.
Thanks again Dung L. for pointing me.
Hey Dung,
Thank you for sharing this tip with others! Well, I'm not confident with this command, I mostly do things like "chown", but if it works for you - great! I'm far from Linux expert :) And yeah, permissions might be tricky sometimes :/
Cheers!
Sorry and please ignore all of my comments above, i was so confused by many things. The actual issue with this is because I left a dump statement in twig template hence it will load with error 500 in PROD environment! This took me down to rabbit hole. All is fixed now.
Thank you for your time!
Hey Dung!
Ah, I see... OK, glad you figured out the problem yourself, good job! Yeah, by default that dump() works only in dev env.
Cheers!
Thank you for your support.
Bonjour
I follow the course but I can' t install symfony 4 . It's Symfony 5 that it installed.
Can I follow all courses with symfony 5 ?
What I have to do to force composer to install symfony 4 ?
^4 to install symfony 4 generate an error.
Thanks you four tour answer.
I found the solution.
the command below doesn't work:
composer create-project symfony/skeleton:^4 the_spacebar
I use this one :
composer create-project symfony/skeleton the_spacebar 4.0.*
Symfony4 will be installed and not symfony 5
Hey Anshen,
Ah, probably "^" symbol is a special for your terminal. I wonder what OS do you use? Because yours command does not work for my terminal, and I'm on Mac. I suppoose if you wrap the package name and its version with quotes - it shoudl fix the problem. Please, could you confirm that this command also work for you?
$ composer create-project 'symfony/skeleton:^4' the_spacebar
I think we should fix this command in script. Thanks for reporting it!
Cheers!
Hey Victor,
I'm sorry to answer that now. The classes are so exciting ... I am very happy to finally learn while keeping the smile inside.
As OS, I use Windows 7 Professional and, as terminal I use Cmder.
I just tested, this command, it does not work for me :
$ composer create-project 'symfony/skeleton:^4' the_spacebar
Thank you for your reply
Cheers
Hey Anshen,
Thank you for your reply! Hm, that's weird... it just should work. What if you wrap package name with version constraint in double quotes instead? Like:
$ composer create-project "symfony/skeleton:^4" the_spacebar
Does it help? Or probably it might also depend on your Composer version. What exactly version do you have?
Cheers!
Hey Victor,
it's works :
$ composer create-project "symfony/skeleton:^4" the_spacebar
My composer version it's 1.9.1
Thanks
Cheers
Hey Anshen,
Ha, nice! Thank you checking it! Then, if double quotes works for you - I'll tweak the command to use package name in double quotes, it should prevent failures for more people :)
Cheers!
Victor,
This command works for me :
λ composer create-project symfony/skeleton the_spacebar 4.4.*
Hey Anshen,
Thanks for pointing to this issue! Yeah, anyway, your version of this command is correct according to the docs.
Cheers!
Hey @Anshen
Sadly, you cannot follow this tutorials by using Symfony5, it's still pretty new and the real problem are the dependencies, many of them haven't added support for Sf5.
If you are using Symfony CLI you can pass the option
--version=4.4to install version 4.4 or pass any other version you want to useCheers!
Hi @ Diego
Actually, I cannot do the lessons with symfony 5.
I installed symfony 4.0 but I could not do the course.
thanks, I installed symfony 4.4 and it's ok for me.
Cheers!
Yeah, Symfony5 is just too new still. Symfony 4.3 should work too. Cheers!
For those from Indonesia cannot play all videos from this site since Vimeo.com is totally blocked by Indonesia Goverment :(
Hey Yusuf,
We're sorry about it! Yes, we do use Vimeo for hosting our videos, but unfortunately nothing much we can do here to make it non-blocked for your country. Probably some VPN could help you to get access to it.
Cheers!
cannot play the video, tried to download but unsuccessful "Firefox can’t establish a connection to the server at player.vimeo.com." I have good internet connection
Hey yusuf
That's odd but it's possible that Vimeo had an outage. Could you give it another try?
Cheers!
Vimeo.com is blocked by Indonesian goverment T_T
https://vimeo.com/ is unaccesible from my ubuntu laptops
Hi I am on the different laptop and account and the result is still the same error with following message "This is a modal window.The media could not be loaded, either because the server or network failed or because the format is not supported."
Hey Yusuf,
We're sorry about it! But unfortunately nothing much we can do to unblock Vimeo in your country. I can only suggest to try some VPN servers that may bypass the blocking.
Otherwise, we do want to make our coruses accessible to everyone, that's why we have scripts below each video with exactly what we're saying in the video. Also, those scripts include dynamic expandable code blocks of the exactly what we're coding in the videos. So you can still continue reading and coding with us.
I hope this helps!
Cheers!
Seems like I always have to do things the hard way. I followed the tutorial and on my dev server that already has a running web server. I ran the composer create-project symfony/skeleton the_spacebar. When I went to https://my.serverurl.com/de.... I got a shock that it just listed the files in the directory. A huge red flag. Something is wrong. So, I opened the .env file instinctively. PHPStorm placed the red squiggly line under the file so I know more stuff is wrong.
I tried to find how to setup symfony on an existing web server. Found way to much stuff that don't answer my question about the .env file config. I did run the suggested Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
Still see directory list. I changed all the # to /. Still no joy and added TRUSTED_HOSTS='^localhost|my.url\.com$'.
How do I fix this to run properly?
Hey Sherwin,
Sure, for a real web server you need some more configuration to spin up the website. Symfony has exmple configuration for both most popular web servers: Apache and Nginx, see this doc about it: https://symfony.com/doc/cur...
I don't know what exactly web server you have, but here's a little hint for you in case you're using Apache: Install this https://github.com/symfony/... that will execute its recipe and copy/paste the .htaccess file into your public directory: https://github.com/symfony/...
Cheers!
Video 1 post project build is incorrect (obsolete)
After the initial project build... The screen shows
What's next?
* Run your application:
1. Go to the project directory
2. Create your code repository with the git init command
3. Download the Symfony CLI at https://symfony.com/download to install a development web server
* Read the documentation at https://symfony.com/doc
Hey T. Wagner,
Could you clarify what exactly is incorrect on your opinion? This message comes from Symfony, and it depends on the version of Symfony. If you upgrade the project dependencies - the message might be a slightly different.
Cheers!
hey!
i have a problem when i create a empty project, when i come to the welcome page,it's ok,the web show me,but the log tell me there is a error
"Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /" (from "http://127.0.0.1:8000/_profiler/14e990?panel=logger")" at /my-project/vendor/symfony/http-kernel/EventListener/RouterListener.php line 139"
i try lots of ways to solve it,but still error,i am new in symfony,could u help me?
thank you so much
Hey there!
Ah, that's OK. Well, if you see the default " Welcome to Symfony" page - that's OK. It means it's the default temporary page from Symfony to get you started, but in your project there's no any route that handles "/" URL. So, when you create a route for "/" - Symfony will automatically renders *your* page instead of this default one. So, just go further in this tutorial and create a new controller for your custom homepage ;)
Cheers!
Can you tell me, which terminal are you using? I started using xampp shell, but for instance, can stop the server with ctrl c, and I had to close some windows and open new ones. I would like to use, the one you are using.
Thanks
Hey Hugo,
In the video Ryan uses iTerm2 on his Mac. I suppose you're on Windows, so, you can take a look at Git Bash, or probably a popular https://github.com/cmderdev... .
Cheers!
Hello and thank you for this great material but I am getting an error that says:
<blockquote>your requirements could not be resolved to an installable set of packages</blockquote>
Problem is related to facebook/webdriver 1.6.0
I wish I could upload image showing the error here, will try to do so by pasting from this URL: href="https://content.screencast.com/users/RicardoRodriguezTecF/folders/Snagit/media/a1ae1ffd-6e4d-485f-9b8f-c8ea54db064e/02.06.2019-20.54.png
I am running PHP 7.3 and composer 1.8.3
<br /><a href="https://content.screencast.com/users/RicardoRodriguezTecF/folders/Snagit/media/a1ae1ffd-6e4d-485f-9b8f-c8ea54db064e/02.06.2019-20.54.png"><img class="embeddedObject" src="https://content.screencast.com/users/RicardoRodriguezTecF/folders/Snagit/media/a1ae1ffd-6e4d-485f-9b8f-c8ea54db064e/02.06.2019-20.54.png" width="979" height="512" border="0" /></a><br />Hey Ricardo,
Just replied to you in Twitter: https://twitter.com/bochars... . Installing curl PHP extension should fix the problem.
Cheers!
Awesome! Thank you so much, worked like a charm.
how to update symfony its showing old version in my browser
like
Welcome to Symfony 3.4.20
Hey Suleman,
To upgrade Symfony with its dependencies - first of all you need to change version constraint for symfony/symfony in composer.json and then run "composer update". And you also need to look inside UPGRADE manuals that you can find in symfony repo: https://github.com/symfony/... - for example, here's what you need to do to upgrade from Symfony 4.1 to 4.2: https://github.com/symfony/... . Btw, we have a few tutorials where we show how to upgrade Symfony properly, you can take a look at:
https://symfonycasts.com/sc...
https://symfonycasts.com/sc...
P.S. Also, keep in mind that new Symfony 4 requires PHP 7.1.3, if you have a lower version of your PHP - you won't be able to upgrade, upgrade your PHP first.
Cheers!
Hey Ryan,
When I run the command "composer create-project symfony/skeleton name_of_project" it installs version 3.4.20.
How is this possible and how can I upgrade to symfony 4?
Best regards,
Dennis
P.S. I did run composer self-update before installing the project.
"Houston: no signs of life"
Start the conversation!