简体   繁体   English

Kali无法安装不同版本的php

[英]Unable to install different versions of php in Kali

I have php 7.3 running on kali but I need to downgrade to 7.1 to accommodate an old library.我在 kali 上运行了 php 7.3,但我需要降级到 7.1 以适应旧库。

When I run sudo apt-get install php7.1 I get an error saying there is no installation package found.当我运行sudo apt-get install php7.1 ,我收到一条错误消息,提示找不到安装 package。 This happens for every version of php I try.我尝试的每个版本的 php 都会发生这种情况。

Is there any reason this might be happening?有什么原因可能会发生这种情况吗?

Try this尝试这个

$ sudo apt-get -y install php7.0 libapache2-mod-php7.0

//Restart the server //重启服务器

$ systemctl restart apache2


second method 第二种方法

If first method will not work for you then enter this command to update and upgrade all kali environment and tools如果第一种方法对您不起作用,请输入此命令以更新和升级所有 kali 环境和工具

apt-get clean && apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade && apt autoremove

After running this command run this again运行此命令后再次运行

$ sudo apt-get -y install php7.0 libapache2-mod-php7.0

Hope this will solve your issue希望这能解决您的问题

Execute this in your console在您的控制台中执行此操作

a2dismod

and chose the version of php you wish to disable, then execute并选择您希望禁用的 php 版本,然后执行

a2enmod

and chose the php version you wish to enable in your Apache server.并选择您希望在 Apache 服务器中启用的 php 版本。 Finally just restart you apache with:最后只需重新启动 apache :

service apache2 restart

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

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