简体   繁体   English

如何在Ubuntu 12.04中将PHP版本从5.3降级到5.2?

[英]How to downgrade PHP version from 5.3 to 5.2 in Ubuntu 12.04?

I have freshly installed Ubuntu 12.04 and I have installed PHP as well. 我刚刚安装了Ubuntu 12.04,我也安装了PHP。 By default, it is installed with version 5.3.10 but my PHP project doesn't support PHP v5.3.10. 默认情况下,它与版本5.3.10一起安装,但我的PHP项目不支持PHP v5.3.10。

I want to downgrade PHP version to 5.2. 我想将PHP版本降级到5.2。 How can I do it? 我该怎么做?

You would have to uninstall PHP and then reinstall an older version. 您必须卸载PHP,然后重新安装旧版本。 However if your working on a project that your going to sell, or give to clients, or whatever the case my suggestion would be take out any functionality thats actually breaking between 5.2x and 5.3x and replace it with its new counter parts, as most people will not want to revert to older versions of PHP for any needs, and generally speaking php versions only goin in one direction, if you block yourself into 5.2 and your making software in one shape or another for people, what are you going to do next year when all the servers come stock with PHP 6? 但是,如果你正在开展一个你要出售的项目,或者给客户,或者任何情况,那么我的建议就是取出任何实际上在5.2x和5.3x之间破坏的功能,并将其替换为新的计数器部分,人们不会想要恢复到旧版本的PHP以满足任何需求,并且一般来说,php版本只会朝着一个方向发展,如果你将自己封锁到5.2并且为了人们制作各种形状的软件,你打算做什么?明年所有的服务器都有PHP 6? Not to mention a lot of hosted solutions try to provide the latest and greatest on there new machines, and will not revert for a single client especially on a shared hosting environment. 更不用说许多托管解决方案试图提供最新和最好的新机器,并且不会恢复单个客户端,特别是在共享托管环境中。

Anyway yea, back to your question again in your terminal under Ubuntu, you can try the following. 无论如何,在Ubuntu下你的终端再次回到你的问题,你可以尝试以下。 sudo apt-get purge php5 which will then prompt you for a password, then proceed with removing PHP assuming you have the PHP package standalone and not bundled in with some preconfigured LAMP stack, but then again it should still work generally speaking so long as the version is right. sudo apt-get purge php5然后会提示你输入密码,然后继续删除PHP,假设你有独立的PHP软件包并没有与一些预先配置的LAMP堆栈捆绑在一起,但是再次它应该仍然可以正常工作,只要它版本是对的。

As for reinstalling it, remove purge from the command and use install. 至于重新安装它,从命令中删除purge并使用安装。 However you will need to look up the means of getting an archived version installed of PHP as apt-get will get you the latest 但是,您需要查找获取PHP安装的存档版本的方法,因为apt-get将为您提供最新信息

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

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