How to upgrade PHP5 to PHP7 under Centos
1. First download the PHP7 installation package, use wget http://am1.php.net/distributions/php-7.2.0.tar.bz2, or visit the download directly, and then Ftp to linux server
Recommended: "php training"
2. Unzip the compressed package, tar –xjf php-7.0.2.tar.bz2
3. Enter the folder, cd php-7.0.2, and install the necessary dependent tools.
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel
The main purpose here is to upgrade, which is usually installed in php5, so this step can be omitted
4. Install several dependencies (must be installed, otherwise the libphp7.so file used by apache cannot be generated later)
yum -y install perl yum –y install perl-devel yum -y install httpd-devel find /usr -name apxs 取得所用路径,后面编译时用到。
5. Prepare for compilation
./configure --prefix=/usr/local/php7 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath -enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --enable-pcntl --with-curl --with-fpm-user=nginx --enable-ftp --enable-session --enable-xml --with-apxs2=/usr/bin/apxs
**Note: –enable -gd-native-ttf does not need to be installed. It is used for graphics processing. If necessary, it can be installed in an extended form later
–with-apxs2=/usr/bin/apxs. Change the subsequent path to step 4 to obtain The path
–prefix=/usr/local/php7 is installed separately in the php7 folder to avoid conflicts with php5 **
6. Compile
make
This step is easy There are many problems,
If you encounter, for example: undefine. . . .
/ext/cli./php … Openssl
and other errors, and make sure that the relevant modules are installed, generally clearing the previous compilation, deleting the relevant files and recompiling
make clean rm –rf /usr/local/php7
can generally solve the problem.
7. Installation
Make install
8. Prepare the configuration file
cp php.ini-developement /etc/php.ini //根据实际情况,可以使用production或者development默认配置 cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
9. Need to modify the apache configuration file
Vi /etc/httpd/conf/ httpd.conf Find LoadModule php7_module modules/libphp7.so. If it is not added manually,
Comment out LoadModule php5_module modules/libphp5.so
cp /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf_5 Vi /etc/httpd/conf.d/php.conf
Change it to the following: (will involve Comment out php5 and change to php7 related modules)
<IfModule prefork.c> LoadModule php7_module modules/libphp7.so </IfModule> <Files ".user.ini"> <IfModule mod_authz_core.c> Require all denied </IfModule> <IfModule !mod_authz_core.c> Order allow,deny Deny from all Satisfy All </IfModule> </Files> DirectoryIndex index.php # mod_php options <IfModule mod_php7.c> <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> php_value session.save_handler "files" php_value session.save_path "/var/lib/php/session" php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache" </IfModule>
10. Restart the apache server
service httpd restart
For more programming related content, please pay attention to the php Chinese websiteProgramming TutorialColumn!
The above is the detailed content of How to upgrade PHP5 to PHP7 under Centos. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

CentOS Platform Hadoop Distributed File System (HDFS) Performance Optimization Guide Optimizing HDFS Performance is a multi-faceted issue, and multiple parameters need to be adjusted for specific situations. The following are some key optimization strategies: 1. Memory management adjusts the NameNode and DataNode memory configuration: reasonably configure the HADOOP_NAMENODE_OPTS and HADOOP_DATANODE_OPTS environment variables according to the actual memory size of the server to optimize memory utilization. Enable large page memory: For high memory consumption applications (such as HDFS), enabling large page memory can reduce memory page allocation and management overhead and improve efficiency. 2. Disk I/O optimization uses high-speed storage

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

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.

When configuring Hadoop Distributed File System (HDFS) on CentOS, the following key configuration files need to be modified: core-site.xml: fs.defaultFS: Specifies the default file system address of HDFS, such as hdfs://localhost:9000. hadoop.tmp.dir: Specifies the storage directory for Hadoop temporary files. hadoop.proxyuser.root.hosts and hadoop.proxyuser.ro

Enable PyTorch GPU acceleration on CentOS system requires the installation of CUDA, cuDNN and GPU versions of PyTorch. The following steps will guide you through the process: CUDA and cuDNN installation determine CUDA version compatibility: Use the nvidia-smi command to view the CUDA version supported by your NVIDIA graphics card. For example, your MX450 graphics card may support CUDA11.1 or higher. Download and install CUDAToolkit: Visit the official website of NVIDIACUDAToolkit and download and install the corresponding version according to the highest CUDA version supported by your graphics card. Install cuDNN library:

CentOSStream8 system troubleshooting guide This article provides systematic steps to help you effectively troubleshoot CentOSStream8 system failures. Please try the following methods in order: 1. Network connection testing: Use the ping command to test network connectivity (for example: pinggoogle.com). Use the curl command to check the HTTP request response (for example: curlgoogle.com). Use the iplink command to view the status of the network interface and confirm whether the network interface is operating normally and is connected. 2. IP address and gateway configuration verification: Use ipaddr or ifconfi
