Linux operating system : Ubuntu 16.04.3
Original php version : 7.0
- Extension tool for adding software sources
sudo apt-get install software-properties-common apt-transport-https lsb-release ca-certificates
- Add the PPA source of php
add-apt-repository ppa:ondrej/php
OK appears to indicate that the addition is successful .
- Update software source cache
sudo apt-get update
4. Install Php7.x related software packages:
sudo apt-get install php7.3-fpm
5. Install the command line mode of php7.x
sudo apt-get install php7.3-cli
6. Modify the php path of the nginx configuration file
7. Verify that php is upgraded successfully
(1) Enter php -v at the server terminal
(2) Create a new file test.php in the root directory of the website
write content
Open it in the browser, and the printed information is as follows:
8. Install mysql extension
sudo apt install php7.3-mysql
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
9. Enter the command php -m to check whether the mysql extension is installed successfully
10. Modify the /etc/php/7.3/fpm/php.ini file
Add a new line extension=php_mysql.so
11. Install other php extensions if needed
apt install libxml2
apt install libxml2-dev
apt-get install php7.3-mysql
apt-get install php7.3-gd
apt-get install php7.3-curl
apt-get install php7.3-mbstring
apt-get install php7.3-SimpleXML
apt-get install php7.3-xsl
apt-get install php7.3-zip