0

I am using Brew to install latest php version, and it works in my terminal:

$ php -v
PHP 7.3.7 (cli) (built: Jul  5 2019 12:44:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.7, Copyright (c) 1999-2018, by Zend Technologies

But when I create a new symfony framework project, and run symfony server:start, it shows me that symfony using the old php7.1, but the installed latest php is 7.3.

$symfony server:start

 [WARNING] run "symfony server:ca:install" first if you want to run the web server
 with TLS support, or use "--no-tls" to avoid this warning


Jul 31 19:21:51 |DEBUG| PHP    Using PHP version 7.1.23 (from default version in $PATH)

the message shows it using php 7.1.23 from $PATH as default version, so I delete the php7.1.23 from the $PATH, and link php7.3 to the $PATH, but still not work

Moon soon
  • 2,616
  • 2
  • 30
  • 51
  • this might help: https://stackoverflow.com/questions/32482664/symfony-is-linked-to-the-wrong-php-version – noid Jul 31 '19 at 11:38
  • 1
    HINT: `from default version in $PATH` – RiggsFolly Jul 31 '19 at 11:42
  • 1
    @RiggsFolly how symfony find the default version? the php7.3 is in my $PATH too, and it works fine in the normal terminal environment. why symfony skip the php7.3 and choice the 7.1 – Moon soon Jul 31 '19 at 12:04

2 Answers2

2

You can run symfony local:php:list to see a list of all php versions installed. To use a specific version, you can create a .php-version file that contains the version number.

pew007
  • 453
  • 2
  • 7
  • 17
2

It is quite some time after but a fix the same problem in Windows 10 was to change the .php-version codification file to UTF8 (e.g. with notepad++).

B--rian
  • 5,578
  • 10
  • 38
  • 89