if you are using a unix or other base system like that try to run this code php ./bin/console server:run Result: [OK] Server listening on http://127.0.0.1:8000
// Quit the server with CONTROL-C.
PHP 7.3.8 Development Server started at Tue Oct 15 10 019
Thank you for this tip! Yeah, you need to run the script via "php" or give "bin/console" executable permissions. Actually, I tweaked the commands in this chapter and added "php" in front of it. Thanks!
Hi! Is it possible to configure WebServerBundle to working with subdomains? I have an error "DNS_PROBE_FINISHED_NXDOMAIN" on http://test.127.0.0.1:8000
Unfortunately this will not work like this. But you can add to your /hosts file something like <br />127.0.0.1 domain.local<br />127.0.0.1 sub.domain.local<br />
and than start server and try use this 2 domains like http://domain.local:8000 and http://sub.domain.local:8000
Or you can use new symfony-cli server which will allow you to use ssl and *.wip domains for local development
It sounds like your script was executing too long, longer than 30 seconds. If you think it's on purpose, i.e. if you write a script that processes a lot of data - then you probably need to increase maximum execution time in php.ini or make your script wiser, like process only a part of big data at once. But if you're trying to load a regular page - it's no good, probably something is broken in your code, maybe you have a recursion? You can try to install xdebug and try again. Or something is broken in your environment configuration.
Could you explain a bit more? Are you talking about the code you downloaded from this course? Are you in start/ or finish/ folders? What page exactly are you trying to load? Is it homepage, i.e. http://127.0.0.1:8000/ ?
Hi, thank you for your prompt response. Sorry I didn´t clarify that I haven't code anything, I'm just following the tutorial, I install de composer server, initialize it, but when I open the browser I try to load localhost:8000, I'm getting the error message.
Hm, ok, let me clarify the steps you have done so far. You created the project with "composer create-project symfony/skeleton the_spacebar", then changed your current directory to the project with "cd the_spacebar" and inside that directory executed "composer require server". But when you run "bin/console server:run" it starts the web server and show you what URL you can use to access it, i.e. http://127.0.0.1:8000.
You don't see any errors in the console output after you run the web server? Try to go to http://127.0.0.1:8000 again wait until you see the error and check console output again. Do you have any new lines there? Any errors? Server write logs into the console as its output, so you may find a problem there.
Though your problem seems like something is blocking the request, probably system ask you allowing new connections with some kind of popup and you didn't allow access or miss that popup? Probably you have an antivirus system that might block this connection? Btw, are you on Windows OS? Could you try to turn your antivirus off completely and try again? Also, I'd suggest you to completely restart your computer before start doing anything that I advised you in this comment.
Let me know if it helps. Also, if it's still does not work, please, could you paste in your next comment the full output of the server:run command you have in your console after a few timeout requests in the browser.
It looks like you need to install Symfony plugin. You can do it in "Settings->Plugins" type "Symfony plugin" in search field, and click "install" after restart PhpStorm, and now it should work
hello there, I´m getting some error message when opening the web page, just after creating and running the server right on the start -->
Fatal error: Unknown: Failed opening required 'D:\nprojetos\composer\the_spacebar\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='C:\xampp_\php\PEAR') in Unknown on line 0
it still fails. If i run php -S 127.0.0.1 -t public then its working.. I have console file also in bin folder. when i run {{ php bin/console server:run }} then in CLI OK server listening on 127.0.0.1:8000 is coming but in browser its not coming
Hmm. That is super strange! The server:run command is basically a wrapper around running the php -s command. But, if the other command is working for you, you can safely just use that. The server:run command mostly exists as a shortcut.
Which is the correct value for "App Directory" in the Symfony Plugin configuration for Symfony 3 or 4? Since in the video you doesn't change the default values. I know that for "Web directory" the value should be "public" but not sure what should be instead of "app" in "App Directory".
Good question! I just always keep app/ as a value for the "app directory" for both Symfony 3 and 4. Though not sure for what exactly this value is used in this plugin :)
Looks like it works for you now. Yeah, pulling symfony/symfony with all its deps may take some time. Btw, if we're talking about Symfony 4, i.e. symfony/skeleton - you should avoid symfony/symfony dependency and specify other minor deps explicitly because it causes conflict on this package, see: https://github.com/symfony/...
Good catch! Actually, those are not important for us yet. Well, app is matched so no changes are needed, however we don't have translations so we can miss it. What about Web Dir - yeah, it should be set to "public" for Symfony 4 applications, but as I said it's not important for us so far. It helps with assets, i.e. provide autocompletion for files inside of "public/" directory. So, you may tweak this value in advance or leave it for later.
Hi there, First off finally found a Symfony 4 course in English that makes sense. But came across my first issue. I installed the composer require server and in the video you run the command "./bin/console server:run" to execute. This doesn't work for me. Is it because I'm on a Win10 using Visual Studio Code internal Terminal? I always have to add php to my console commands.? "php bin/console server:run" DO you know why?
Ok my bad ... Watch the vid might help....lol But why the php for win users ?
Glad you got it! Really, just add "php ./bin/console" for all Symfony commands. It's due to different file system. Mac OS and Linux based OS like Ubuntu are Unix based platforms, but Windows is not. bin/console is just a PHP file, so to run any PHP file on Windows you always need to run it though php interpreter.
Im getting parse errors in both bin/console and public/php.index I haven't touch either of those files, but they seem to be keeping me from running the server with either `./bin/console server:run` or `php -S 127.0.0.1:8000 -t public` Anyone run into something like this? Thanks
Hmm, interesting! I do have a theory: you may be using an out-dated PHP version. Symfony 4 requires PHP 7.1, so if you're using something lower, then those files would appear to have syntax errors for that PHP version. What do you see when you run:
php -v
If it's below 7.1.3, then get that guy upgraded :). Let us know!
I get 7.2.2 when I run from a new terminal window but in my repo directory i get `PHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies` I tried to update to 7.2 earlier but I guess it didn't work. Im on a Mac OS X 10.11.6 el capitan if that helps with anything
EDIT: I opened a new terminal window and ran php -v still got 5.5.38
Ah, ok, so you need to upgrade your PHP version somehow to 7.1.3 at least if you want to run Symfony 4. I also on a Mac, and I installed my PHP version with Homebrew, see https://github.com/Homebrew... if it helps you. Otherwise, I think you can google for some post about how to install/upgrade PHP on your Mac.
I am on a Mac but in my development setup I prefer run the project in an Ubuntu 16.04 VM (with Vagrant and Virtual Box) and I wonder if I can still setup composer as you show in the video.
70 Comments
Hi,
On my PhpStorm 2017.3.3 the composer.json was automatically found and loaded :-)
Hey Robertino V.
Ohh, so that's a new feature of newest PhpStorm version? I haven't upgraded mine yet :p
Cheers!
Yup, composer.json is automatically loaded and symfony plugin is automatically configured.
Thanks PHPStorm
Ohh PHPStorm, you always surprise me :)
Hey Sir,
Looks like you found the solution, but just for the record here:
On Windows you need to run any PHP script you want via PHP interpreter.
Cheers!
I got this message "The media could not be loaded, either because the server or network failed or because the format is not supported."
I replied you in the other thread. Cheers!
if you are using a unix or other base system like that try to run this code
php ./bin/console server:run
Result:
[OK] Server listening on http://127.0.0.1:8000
// Quit the server with CONTROL-C.
PHP 7.3.8 Development Server started at Tue Oct 15 10 019
Hey OM,
Thank you for this tip! Yeah, you need to run the script via "php" or give "bin/console" executable permissions. Actually, I tweaked the commands in this chapter and added "php" in front of it. Thanks!
Cheers!
It seems Symfony Plugin is not found at the respective repository anymore.
Instead of it, there is Symfony Support. I don't know if the last one is a replacement for the first one.
Does anybody know if Symfony Plugin is still available? Best regards.
Using PHPStorm 2019.2 (evaluate version).
Hey Abelardo,
It looks like "Symfony Plugin" was renamed to "Symfony Support" plugin, here's the official links:
https://plugins.jetbrains.c...
https://github.com/Haehnche...
This is the plugin we're talking about in this screencast.
Though, I noticed problems with plugins upgrades on my latest version of PhpStorm, not sure about the reason yet.
Cheers!
Hi!
Is it possible to configure WebServerBundle to working with subdomains?
I have an error "DNS_PROBE_FINISHED_NXDOMAIN" on http://test.127.0.0.1:8000
hey Alexey N.
Unfortunately this will not work like this. But you can add to your
/hostsfile something like<br />127.0.0.1 domain.local<br />127.0.0.1 sub.domain.local<br />and than start server and try use this 2 domains like
http://domain.local:8000andhttp://sub.domain.local:8000Or you can use new
symfony-cliserver which will allow you to use ssl and *.wip domains for local developmentCheers!
Hi, I'm really new to this. How can I acces database here? Or do I need to set XAMMP or Docker or any other server for that?
Hey Algirdas Žarkaitis
You should have a database server you can install it as standalone instance or via docker depending on you dev environment.
Cheers!
After installing the composer server, it says it´s running
[OK] Server listening on http://127.0.0.1:8000
But, when openning the web page, i´m getting the following error:
Whoops, looks like something went wrong.
(1/1) FatalErrorException
Error: Maximum execution time of 30 seconds exceeded
in Router.php line 34
Hey Hugo,
It sounds like your script was executing too long, longer than 30 seconds. If you think it's on purpose, i.e. if you write a script that processes a lot of data - then you probably need to increase maximum execution time in php.ini or make your script wiser, like process only a part of big data at once. But if you're trying to load a regular page - it's no good, probably something is broken in your code, maybe you have a recursion? You can try to install xdebug and try again. Or something is broken in your environment configuration.
Could you explain a bit more? Are you talking about the code you downloaded from this course? Are you in start/ or finish/ folders? What page exactly are you trying to load? Is it homepage, i.e. http://127.0.0.1:8000/ ?
Cheers!
Hi, thank you for your prompt response. Sorry I didn´t clarify that I haven't code anything, I'm just following the tutorial, I install de composer server, initialize it, but when I open the browser I try to load localhost:8000, I'm getting the error message.
Hey Hugo,
Hm, ok, let me clarify the steps you have done so far. You created the project with "composer create-project symfony/skeleton the_spacebar", then changed your current directory to the project with "cd the_spacebar" and inside that directory executed "composer require server". But when you run "bin/console server:run" it starts the web server and show you what URL you can use to access it, i.e. http://127.0.0.1:8000.
You don't see any errors in the console output after you run the web server? Try to go to http://127.0.0.1:8000 again wait until you see the error and check console output again. Do you have any new lines there? Any errors? Server write logs into the console as its output, so you may find a problem there.
Though your problem seems like something is blocking the request, probably system ask you allowing new connections with some kind of popup and you didn't allow access or miss that popup? Probably you have an antivirus system that might block this connection? Btw, are you on Windows OS? Could you try to turn your antivirus off completely and try again? Also, I'd suggest you to completely restart your computer before start doing anything that I advised you in this comment.
Let me know if it helps. Also, if it's still does not work, please, could you paste in your next comment the full output of the server:run command you have in your console after a few timeout requests in the browser.
Cheers!
Hi, great job, nice and funny narration, and most importantly - a huge package of valuable knowledge.
hi ,
there is no symfony in language&frameworks->php
please help
its in language&frameworks->PHP
Hi siddhartha
It looks like you need to install Symfony plugin. You can do it in "Settings->Plugins" type "Symfony plugin" in search field, and click "install" after restart PhpStorm, and now it should work
Cheers!
hello there, I´m getting some error message when opening the web page, just after creating and running the server right on the start -->
Fatal error: Unknown: Failed opening required 'D:\nprojetos\composer\the_spacebar\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='C:\xampp_\php\PEAR') in Unknown on line 0
Does anyone know what this is about?
I solved using this reference, in case anyone need ->
https://stackoverflow.com/q...
Solved by :
Delete symfony folder in vendor
composer update
If you have antivirus (like Avast) disable it before launching web server
php bin/console server:run
Ohh so your Antivirus was interfering with the script that starts the web server? Anyways, thanks for sharing your solution!
Cheers!
.bin/console server:run is saying could not open file error. Help ASAP.
Hello Suman kumar P.
Please check command you trying to run. it should be like
php bin/console server:run
If it still fails, check if you have file "console" in "bin\" folder and reply here
Cheers!
it still fails. If i run php -S 127.0.0.1 -t public then its working..
I have console file also in bin folder.
when i run {{ php bin/console server:run }} then in CLI OK server listening on 127.0.0.1:8000 is coming but in browser its not coming
Hey @Hunter Baba!
Hmm. That is super strange! The server:run command is basically a wrapper around running the php -s command. But, if the other command is working for you, you can safely just use that. The server:run command mostly exists as a shortcut.
Cheers!
Why dont you colorised command line greeting? I mean `~/path/file$`. It would be easier to find this lines if they would be colored differently.
Which is the correct value for "App Directory" in the Symfony Plugin configuration for Symfony 3 or 4? Since in the video you doesn't change the default values. I know that for "Web directory" the value should be "public" but not sure what should be instead of "app" in "App Directory".
Hey Roberto,
Good question! I just always keep app/ as a value for the "app directory" for both Symfony 3 and 4. Though not sure for what exactly this value is used in this plugin :)
Cheers!
Got stuck at Restricting packages listed in "symfony/symfony" to "4.1.*" after running composer require server. Please help.
It's ok now. It just took too long to long..
Hey Lyndonjohn,
Looks like it works for you now. Yeah, pulling symfony/symfony with all its deps may take some time. Btw, if we're talking about Symfony 4, i.e. symfony/skeleton - you should avoid symfony/symfony dependency and specify other minor deps explicitly because it causes conflict on this package, see: https://github.com/symfony/...
Cheers!
Hi @weaverryan
In PhpStom's Symfony Plugin no need set 'Translation Root Path', 'App Directory' and 'Web Directory' paths?
Hey niumis.
Good catch! Actually, those are not important for us yet. Well, app is matched so no changes are needed, however we don't have translations so we can miss it. What about Web Dir - yeah, it should be set to "public" for Symfony 4 applications, but as I said it's not important for us so far. It helps with assets, i.e. provide autocompletion for files inside of "public/" directory. So, you may tweak this value in advance or leave it for later.
Cheers!
Thank you, victor!
Hi there,
First off finally found a Symfony 4 course in English that makes sense.
But came across my first issue.
I installed the composer require server and in the video you run the command "./bin/console server:run" to execute.
This doesn't work for me. Is it because I'm on a Win10 using Visual Studio Code internal Terminal?
I always have to add php to my console commands.? "php bin/console server:run"
DO you know why?
Ok my bad ... Watch the vid might help....lol
But why the php for win users ?
Hey Kribo ,
Glad you got it! Really, just add "php ./bin/console" for all Symfony commands. It's due to different file system. Mac OS and Linux based OS like Ubuntu are Unix based platforms, but Windows is not. bin/console is just a PHP file, so to run any PHP file on Windows you always need to run it though php interpreter.
Cheers!
victor
hi thnx for the response.
Any idea when the other vids 6,7 & 8 will be published?
.
Hey Kribo
We published chapter 6 today! And we publish a new chapter every day, so, by tomorrow you should be able to watch chapter 7 :)
Have a nice day
Cool cannot wait ...
Hi,
Im getting parse errors in both bin/console and public/php.index
I haven't touch either of those files, but they seem to be keeping me from running the server with either `./bin/console server:run` or `php -S 127.0.0.1:8000 -t public`
Anyone run into something like this?
Thanks
Hey Billy Thomas!
Hmm, interesting! I do have a theory: you may be using an out-dated PHP version. Symfony 4 requires PHP 7.1, so if you're using something lower, then those files would appear to have syntax errors for that PHP version. What do you see when you run:
If it's below 7.1.3, then get that guy upgraded :). Let us know!
Cheers!
I get 7.2.2 when I run from a new terminal window but in my repo directory i get
`PHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies`
I tried to update to 7.2 earlier but I guess it didn't work. Im on a Mac OS X 10.11.6 el capitan if that helps with anything
EDIT: I opened a new terminal window and ran php -v still got 5.5.38
Hey Billy,
Ah, ok, so you need to upgrade your PHP version somehow to 7.1.3 at least if you want to run Symfony 4. I also on a Mac, and I installed my PHP version with Homebrew, see https://github.com/Homebrew... if it helps you. Otherwise, I think you can google for some post about how to install/upgrade PHP on your Mac.
Cheers!
hello Ryan,
I am on a Mac but in my development setup I prefer run the project in an Ubuntu 16.04 VM (with Vagrant and Virtual Box) and I wonder if I can still setup composer as you show in the video.
thanks a lot for your help
cheers
Hey chieroz
Do you mean setup composer on PhpStorm? If that's the case you would have to install composer as well on your "Host" machine
Cheers!
Hello Diego,
yes, I mean setup composer non PhpStorm (btw, this editor is AWESOME).
thank you for your time
carlo
"Houston: no signs of life"
Start the conversation!