Home > Backend Development > PHP Tutorial > A quick way to install PHP on Ubuntu or CentOS

A quick way to install PHP on Ubuntu or CentOS

藏色散人
Release: 2023-04-11 08:08:02
forward
3007 people have browsed it

Install PHP

  • Install PHP on Ubuntu

  • ##
    $ sudo apt-get install software-properties-common
    $ sudo add-apt-repository ppa:ondrej/php
    $ sudo apt-get update
    $ sudo apt-get install php8.1
    $ sudo apt-get install php8.1-mysql php8.1-curl php8.1-json php8.1-dev php8.1-mbstring php8.1-ctype php8.1-dom php8.1-gd php8.1-openssl php8.1-simplexml php8.1-xml php8.1-fpm php8.1-opcache php8.1-cli php8.1-apcu
    Copy after login
If you need to install other extensions, execute sudo apt-get install php8.1-xxxx (extension). If you install PHP7.3, please replace the above php8.1 with php7.3.

  • Installing PHP on CentOS

The following is how to install PHP on CentOS 7

$ sudo yum install epel-release
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum install yum-utils
$ sudo yum-config-manager --enable remi-php81
$ sudo yum update
$ sudo yum install php81
$ sudo yum install php81-php-fpm php81-php-gd php81-php-json php81-php-mbstring php81-php-mysqlnd php81-php-xml php81-php-xmlrpc php81-php-opcache php81-php-devel php81-php-cli php81-php-apcu php81-php-curl php81-php-dom
$ sudo systemctl enable php81-php-fpm.service
$ sudo systemctl start php81-php-fpm.service
Copy after login
If you need to install other extensions, just execute sudo yum install php81-php-xxxx (extension). If you install PHP7.3, please replace the above php81 with php73.

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of A quick way to install PHP on Ubuntu or CentOS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:p2hp
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template