Package php5 have no installation candidate (Ubuntu 16.04)

后端 未结 7 1835
自闭症患者
自闭症患者 2020-12-04 17:33

When i try to install php5 in Ubuntu 16.04 by using following code:

sudo apt-get install php5 php5-mcrypt

I get following error:

         


        
相关标签:
7条回答
  • 2020-12-04 17:47

    This worked for me.

    sudo apt-get update
    sudo apt-get install lamp-server^ -y
    

    ;)

    0 讨论(0)
  • 2020-12-04 17:51

    Currently, I am using Ubuntu 16.04 LTS. Me too was facing same problem while Fetching the Postgress Database values using Php so i resolved it by using the below commands.

    Mine PHP version is 7.0, so i tried the below command.

    apt-get install php-pgsql

    Remember to restart Apache.

    /etc/init.d/apache2 restart
    
    0 讨论(0)
  • 2020-12-04 17:54

    I recently had this issue as well and solved it using the following command:

    sudo apt install php7.2-cli
    

    php is now installed. I'm using Ubuntu 18.04.

    0 讨论(0)
  • 2020-12-04 17:57

    Ubuntu 16.04 comes with PHP7 as the standard, so there are no PHP5 packages

    However if you like you can add a PPA to get those packages anyways:

    Remove all the stock php packages

    List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use :

    sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
    

    Add the PPA

    sudo add-apt-repository ppa:ondrej/php
    

    Install your PHP Version

    sudo apt-get update
    sudo apt-get install php5.6
    

    You can install php5.6 modules too ..

    Verify your version

    sudo php -v
    

    Based on https://askubuntu.com/a/756186/532957 (thanks @AhmedJerbi)

    0 讨论(0)
  • 2020-12-04 17:59

    You must use prefix "php5.6-" instead of "php5-" as in ubuntu 14.04 and olders:

    sudo apt-get install php5.6 php5.6-mcrypt
    
    0 讨论(0)
  • 2020-12-04 18:00
    sudo apt-get install php7.0-mysql
    

    for php7.0 works well for me

    0 讨论(0)
提交回复
热议问题