FreeBSD:将PHP4升级到PHP5

时间:2020-01-09 10:38:42  来源:igfitidea点击:

如何在FreeBSD操作系统下将PHP4更新为PHP5?

您可以使用portupgrade和portmaster命令的-o选项轻松指定要升级的端口。
要将安装的端口替换为其他来源的端口,请使用以下语法:

FreeBSD更新php语法

portupgrade -o {new/port} {old-port} portmaster -o {new port dir in /usr/ports} {installed port}

警告!在尝试以下命令之前,请备份数据和php/apache配置。

找出PHP4版本

首先,找出php4版本(这很重要,因为解决方法:您需要提供确切的版本号):

# pkg_info | grep php4

输出示例:

php4-4.4.9          PHP Scripting Language (Apache Module and CLI)

如何将PHP4升级到PHP5

要使用portmaster command用php5替换/升级php4,请执行:

# portmaster -o /usr/ports/lang/php5 php4-4.4.9 to upgrade php5

要使用" portupgrade命令"用php5替换/升级php4,请执行:

# portupgrade -o lang/php5 php4

输出示例:

** Detected a package name change: php4 (lang/php4) -> 'php5' (lang/php5)
--->  Upgrading 'php4-4.4.9' to 'php5-5.2.9' (lang/php5)
--->  Building '/usr/ports/lang/php5'
===>  Cleaning for php5-5.2.9
===>  Found saved configuration for php5-5.2.8
===>  Extracting for php5-5.2.9
=> MD5 Checksum OK for php-5.2.9.tar.bz2.
=> SHA256 Checksum OK for php-5.2.9.tar.bz2.
=> MD5 Checksum OK for suhosin-patch-5.2.9-0.9.7.patch.gz.
=> SHA256 Checksum OK for suhosin-patch-5.2.9-0.9.7.patch.gz.
......
.....
...===> SECURITY REPORT: 
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/bin/php
/usr/local/bin/php-cgi

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage: 
http://www.php.net/
===>  Cleaning for php5-5.2.9
--->  Cleaning out obsolete shared libraries
[Updating the pkgdb  in /var/db/pkg ... - 249 packages found (-0 +1) . done]

完成后,解决方法:您需要升级和设置位于/usr/local/etc/php.ini和/usr/local/etc/php /的新php配置文件。