PHP Version Update

少于 1 分钟读完

Update PHP Version, Update Apache2 PHP Version, Swich PHP version on Ubuntu

Clean All PHP

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

Update PHP version

  • Update php version
    sudo apt update
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:ondrej/php
    
  • install php 7.4
    sudo apt update
    sudo apt-get install -y php7.4
    

Swich PHP version

  • Swich Terminal PHP version
    sudo update-alternatives --set php /usr/bin/php7.4
    
  • Swich php-fpm version ```sh

# Update Apache2 PHP version

- Install apache2 mods
```sh
sudo apt update
sudo apt-get install -y libapache2-mod-php7.4
  • Enter apache2 mods directory
    cd /etc/apache2/mods-enabled
    
  • Check current php vesion
    ls -l |grep php
    
  • Remove php[version].conf and php[version].load file

  • Create link file for new php version
    ln -s ../mods-enabled/php[version].conf php[version].conf 
    ln -s ../mods-enabled/php[version].load php[version].load 
    
  • Restart apache2
    sudo systemctl restart apache2
    

https://websiteforstudents.com/install-php-8-0-on-ubuntu-20-04-18-04/

标签: ,

分类:

更新时间: