简体   繁体   中英

Symfony framework cannot use homebrew installed php

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

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.

过了一段时间,但在 Windows 10 中修复相同的问题是将 .php-version 编码文件更改为 UTF8(例如使用记事本++)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM