简体   繁体   English

Symfony 3.4 和 PHP 版本

[英]Symfony 3.4 and PHP Version

I'm taking over a project under Symfony 3.4.我正在接管 Symfony 3.4 下的一个项目。

I have an error related to the version of php I guess:我猜我有一个与 php 版本相关的错误:

ContextErrorException
in vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php (line 2636)
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

So I created a.php-version file with "7.2" inside.所以我创建了一个 .php-version 文件,里面有“7.2”。

But when I do a但是当我做一个

php bin\console about

I have the php version in 7.3.5.我有 7.3.5 中的 php 版本。

I have tried also to change my php version in Env variable path of windows 10 and in wamp, but even after a reboot, a我也尝试过在 Windows 10 和 wamp 的 Env 变量路径中更改我的 php 版本,但即使在重新启动后,a

php -v

show a 7.3.5 version.显示 7.3.5 版本。

An idea to force the php version that my Symfony app must use?强制使用我的 Symfony 应用程序必须使用的 php 版本的想法?

Thanks in advance.提前致谢。

If you have multiple php versions installed in multiple directories and you wish to use a certain php version on the command line you need to specify which php to use, and which php.ini to use.如果您在多个目录中安装了多个 php 版本,并且您希望在命令行上使用某个 php 版本,您需要指定要使用的 php 以及要使用的 php.ini。

For command line(CMD):对于命令行(CMD):

C:\php7.1\php.exe -c C:\php7.1\php.ini bin\console about

git for windows bash用于 Windows bash 的 git

/c/php7.1/php.exe -c /c/php7.1/php.ini bin/console about

For your wamp server you need to define which php version to use via the httpd.conf or the other config files you may use.对于您的 wamp 服务器,您需要通过 httpd.conf 或您可能使用的其他配置文件定义要使用的 php 版本。

I need to run some things on 5.6 to be able to check back old sites and for that I use to get it working on my dev machine.我需要在 5.6 上运行一些东西才能检查旧站点,为此我用它来让它在我的开发机器上运行。

ScriptAlias /php/ "C:/php-5.6.9-Win32-VC11-x64/"
AddHandler application/x-httpd-php .php .html .htm
#SetEnv PHP_INI_SCAN_DIR "C:/php-5.6.9-Win32-VC11-x64/"
SetEnv PHPRC "C:/php-5.6.9-Win32-VC11-x64/"
Action application/x-httpd-php "/php/php-cgi.exe"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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