简体   繁体   English

如何在symfony项目中将php版本从7.0降级到5.6?

[英]How to downgrade the php version to 5.6 from 7.0 in a symfony project?

I'm working in a project with Symfony Framework, but i have problems with php 7.0. 我正在使用Symfony Framework开发项目,但是使用php 7.0时遇到问题。 Can I downgrade the php version or I need rewrite the entire application? 我可以降级php版本还是需要重写整个应用程序?

Symfony 3 requires at least PHP 5.5.9, so generally speaking, you can downgrade if you want. Symfony 3至少需要PHP 5.5.9,因此一般来说,您可以根据需要降级。 Of course you might have other limitations, like additional bundles and libraries you have installed and you might have used PHP 7 features inside your own code. 当然,您可能还有其他限制,例如已安装的其他捆绑包和库,并且可能已在自己的代码中使用了PHP 7功能。

If you want to downgrade you can run: 如果要降级,可以运行:

composer why-not php:5.6

This will tell you which libraries you installed will not work with PHP 5.6. 这将告诉您所安装的库不适用于PHP 5.6。 You might be able to downgrade them, but obviously this is not guaranteed and might require changes to how you use those bundles and libraries. 您也许可以降级它们,但是显然不能保证,并且可能需要更改使用这些捆绑软件和库的方式。 For this you will have to check their upgrade guides and "undo" those changes. 为此,您将必须检查其升级指南并“撤消”这些更改。

For checking your own code you can use tools like etsy's phan to check for compatibility with a specific target version of php: https://github.com/phan/phan#usage 为了检查自己的代码,您可以使用etsy的phan之类的工具来检查与特定目标php版本的兼容性: https : //github.com/phan/phan#usage

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

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