PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 2, 2022

[FIXED] How to start local server with symfony 5 or downgrade version to 4.4?

 February 02, 2022     php, symfony, symfony-4.4, symfony4, symfony5     No comments   

Issue

I started a new project in new Symfony 5 and i can't open my local server.

On Symfony 4.4 the command PHP bin/console server:run is OK,

But with Symfony 5 the command appears not to be defined...

C:\Users\Chris\Code\api-test> php bin/console server:run
Command "server:run" is not defined.
Do you want to run "server:dump" instead?  (yes/no) [no]:

So how to downgrade or start the local server?


Solution

The Web Server Bundle is not included with Symfony 5.

But you can simply require it and install it separately.

E.g.:

composer require symfony/web-server-bundle 4.4

It is important that you specify the version (4.4), because otherwise it will attempt to install version 5 (which does not exist, and it will fail).

After that you'll be able to run bin/console server:run as you used to do.


Otherwise, you may use the Symfony CLI as well. This is an executable binary which includes the Symfony Server by default. Then you may run symfony server:start or the better know alias symfony serve to start the local webserver.

Read more about Symfony's server here.


You can also use the built-in web server in the PHP runtime. Just go to your project's root directory and run:

php -S localhost:8000 -t public/

It's not a fully featured webserver, but for developing purposes it is usually more than enough.



Answered By - yivi
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing