我使用PHP7开发了应用程序,但在服务器上有PHP5,我们无法在那里升级PHP

问题描述:

Please help me, I have developed an application using Yii2 Framework which requires PHP5.6 or greater, and while deployment of the application on the test server I have noticed that on the test server we are using PHP5.5, So please tell me what can I do? The test server is running Ubuntu. (Minimum requirement of Yii2 is PHP5.6 and we are using PHP5.5)

Thank You.

请帮助我,我使用Yii2 Framework开发了一个需要PHP5.6或更高版本的应用程序,并且在部署时 测试服务器上的应用程序我注意到在测试服务器上我们使用的是PHP5.5,所以请告诉我该怎么办? 测试服务器正在运行Ubuntu。 (Yii2的最低要求是PHP5.6,我们使用的是PHP5.5) p>

谢谢。 p> div>

You can try a few things...

1) Do you need to have the dev modules from Composer on the test server? If not do a composer install —no-dev

2) Another switch worth trying on the test server is “--ignore-platform-reqs” I don’t recommend it and even though composer install the files the application might not work.

3) If the above isn’t a fix for you, modify your Composer file to put in the constraints of your environments, change your local environment to match the test server, and re-factor the application if necessary. I’d do that instead of rewriting a whole app in Yii1.

You might want to edit your question and add the information about your composer.json file. Do you commit the composer.lock file to source control?

Additionally, not wise for your company to use anything older than PHP 5.6. And PHP 5.6 will have security support ended in Dec 2018. http://php.net/supported-versions.php

if I recall correctly, PHP 5.5.X and 5.6.X are not that different. So if you can deploy your application and it runs properly, you should be fine. If you are using composer, it might be harder (or impossible) to spoof your PHP version, though.

My two cents: You tagged AWS (and therefor probably EC2), so why don't you just update your PHP version? Why don't you run your application on PHP 7.X anyway? It is a great improvement - performance-wise.

Read the following PHP documentation linked below, particularly the backward incompatibility changes and deprecated features. If you use any of those, you need to change your code. If you don't, then you should be fine. You need to test it.

http://php.net/manual/en/migration56.php