How to start local server with symfony 5 or downgrade version to 4.4?
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.
Symfony - Downgrade Minor Version
You can edit just one line in your composer.json
:
"require": {
...
"symfony/symfony": "2.8.*, !=2.8.10",
...
This way, you tell Composer to avoid that specific version. All other dependencies will be retrieved automatically.
Important: you have to remove your composer.lock
file first, as Composer will complain that you're locked to the very same version you're trying to avoid.
Disclaimer: backup and test first. I tested on a base Symfony install, not sure if other package will complain.
Running 2 Symfony projects with different php versions
You can select the php version for the project with
echo 7.4.10 > .php-version
When you create the .php-version for each project you can run the server as you run it usually and everything works fine
Also, when I use 7.4.10 locally, I have to use my commands like this
symfony php bin/console make:migration
with symfony before php bin/console
Related Topics
PHP Get Height and Width in PDF File Proprieties
Replace the Last Comma with an & Sign
Symfony & Guard: "The Security Token Was Removed Due to an Accountstatusexception"
Html2Pdf in PHP - Convert Utilities & Scripts - Examples & Demos
Phpdoc for Variable-Length Arrays of Arguments
How to Access MySQLi Connection in Another Class on Another Page
Merge a Table and a Change Log into a View in Postgresql
Nl2Br() Equivalent in JavaScript
Laravel Expected Response Code 250 But Got Code "530"
Extension PHP5 Does Not Parse in Xampp
Php: What Is the Purpose of Session_Name
PHP JSON_Encode and JavaScript Functions
Implementing "Update If Exists" in Doctrine Orm
Trouble Passing Variables to PHP Script on Image Upload