Home Backend Development PHP7 How to install PHP7 on CentOS78

How to install PHP7 on CentOS78

May 13, 2021 am 09:25 AM
centos php7

This article will introduce to you how to install PHP7 on CentOS78. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to install PHP7 on CentOS78

1. The default PHP version of CentOS7 is PHP5, but if we want to install PHP7, we do not need to delete the existing PHP5, just upgrade PHP to PHP7.

Use the yum provides php command to obtain the CentOS7 PHP package installation status. What is shown is that the latest version that can be installed in the existing installation source is: php-5.4.16-46.el7.x86_64

2. Before installing PHP7, it is recommended to upgrade and update the CentOS7 installation package first. :

yum -y update: Upgrade all software packages and also upgrade the software and system kernel;

yum -y upgrade: Just upgrade all software packages, but not upgrade the software and system kernel.

We use the second item here: yum -y upgrade to upgrade.

After completion, restart httpd: systemctl restart httpd.service: Restart httpd.

Usage: index.php phpinfo(): Test, no php information page is displayed, indicating that php configuration is required.

3. Use: yum remove php-common -y: Remove the php-common installed on CentOS7 so that new php-common can be installed. This step deletes the original php5 of CentOS.

4. Because the yum source of Linux does not exist for php7.x, we must first change the yum source:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/ epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

After executing the above command, Use: php -v: Display

-bash: php: command not found: It means you need to continue configuring php7.

5. Use: sudo yum list php*: View the currently installed PHP version (the latest version).

You can see that the latest version of PHP that can be installed is: php72w.

6. Install php72w: sudo yum -y install php72w: .

After executing the above command, use: php -v: display

-bash: php: command not found:

Although the version information after the successful installation of PHP7 is not displayed, However, php72w has been successfully installed at this time, and the httpd server needs to be restarted to make the newly installed php72w take effect.

7. After completion, use: systemctl restart httpd.service: Restart httpd.

Use browser: index.php phpinfo(): Test, the php information page will appear, indicating that httpd has been initially fully configured with php72w.

8. Then, in order to solve the problem of using: php -v : command not displaying the php72w version, and to make php72w more robust, we recommend installing the php72 extension:

Extension installation 1:

yum install php72w-common php72w-fpm php72w-opcache php72w-gd php72w-mysqlnd php72w-mbstring php72w-pecl-redis php72w-pecl-memcached php72w-devel

上述命令一共会安装30个拓展包,安装过程较慢,请耐心等待。。。
安装的拓展包如下:
php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib

执行上述命令后,使用:   php -v   :显示:   PHP 7.2.16 (cli)   : 说明php72w开发环境基本安装完成。
Copy after login

9. In order to further strengthen php72w In the development environment, it is recommended to enter the following command to install a more comprehensive expansion package for php72w:

安装包			                                提供的拓展
php72w			                           mod_php	, php72w-zts
php72w-bcmath		
php72w-cli		                           php-cgi, php-pcntl, php-readline
php72w-dba		
php72w-devel		
php72w-embedded		                   php-embedded-devel
php72w-enchant		
php72w-fpm		
php72w-gd		
php72w-imap		
php72w-interbase		                     php_database, php-firebird
php72w-intl		
php72w-ldap		
php72w-mbstring		
php72w-mcrypt		
php72w-mysql		                         php-mysqli, php_database
php72w-mysqlnd		                     php-mysqli, php_database
php72w-odbc		                         php-pdo_odbc, php_database
php72w-opcache		                     php72w-pecl-zendopcache
php72w-pdo		                        php72w-pdo_sqlite, php72w-sqlite3
php72w-pdo_dblib		                     php72w-mssql
php72w-pear		
php72w-pecl-apcu	
php72w-pecl-imagick	
php72w-pecl-memcached	
php72w-pecl-mongodb	
php72w-pecl-redis	
php72w-pecl-xdebug	
php72w-pgsql		                      php-pdo_pgsql, php_database
php72w-phpdbg		
php72w-process		        php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php72w-pspell		
php72w-recode		
php72w-snmp		
php72w-soap		
php72w-tidy		
php72w-xml		                    php-dom, php-domxml, php-wddx, php-xsl
php72w-xmlrpc
Copy after login

Each of the above expansion packages is used similarly: yum install php72w-xml: command to install.

Recommended learning: php video tutorial

The above is the detailed content of How to install PHP7 on CentOS78. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

What are the backup methods for GitLab on CentOS What are the backup methods for GitLab on CentOS Apr 14, 2025 pm 05:33 PM

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

How to check CentOS HDFS configuration How to check CentOS HDFS configuration Apr 14, 2025 pm 07:21 PM

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

What is the CentOS MongoDB backup strategy? What is the CentOS MongoDB backup strategy? Apr 14, 2025 pm 04:51 PM

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

What are the common misunderstandings in CentOS HDFS configuration? What are the common misunderstandings in CentOS HDFS configuration? Apr 14, 2025 pm 07:12 PM

Common problems and solutions for Hadoop Distributed File System (HDFS) configuration under CentOS When building a HadoopHDFS cluster on CentOS, some common misconfigurations may lead to performance degradation, data loss and even the cluster cannot start. This article summarizes these common problems and their solutions to help you avoid these pitfalls and ensure the stability and efficient operation of your HDFS cluster. Rack-aware configuration error: Problem: Rack-aware information is not configured correctly, resulting in uneven distribution of data block replicas and increasing network load. Solution: Double check the rack-aware configuration in the hdfs-site.xml file and use hdfsdfsadmin-printTopo

See all articles