Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.11

后端 未结 14 2200
遇见更好的自我
遇见更好的自我 2020-12-18 20:31

I want to create a Symfony CRUD application. These are the steps I did:

  • Downloaded and installed XAMPP from here with PHP 7.3.11 https://www.apachefriends.org/
14条回答
  •  攒了一身酷
    2020-12-18 21:17

    With 2 PHP versions installed, most likely you forgot to change the etc / hosts file for the test domain. Or you need to edit the DNS.

    //file etc/hosts
    #old host -forgot to delete
    127.0.0.71 demo.symfony.local 
    #new host
    127.0.0.74 demo.symfony.local
    

    I don't know how the XAMPP installer works, (since I usually manually install and configure), but I can assume that most likely when installing a new XAMPP, it changed the paths in the PATH variable (why the console works with version 7.4), and added hosts to the etc / hosts file but did not remove the old hosts (so the site works with old version).

    In my case, PHP versions are separated by IP. If you have 2 PHP versions on one IP, then you will have to stop one of them in order to start another or separate the versions by ports. Otherwise, conflict of interest.
    example

    #httpd.conf -Apache settings (Apache folder for PHP 7.3)
    Listen 127.0.0.1:80
    
    #httpd.conf -Apache settings (Apache folder for PHP 7.4)
    Listen 127.0.0.1:80
    
    # etc/hosts
    127.0.0.1 localhost
    

    Result: localhost will contact the one who first occupied port 127.0.0.1:80 in the listening queue.

提交回复
热议问题