How to install php on centos7.5: 1. Add php user for running php-fpm process; 2. Unzip the php source code package; 3. Install dependency packages; 4. Copy relevant configuration files to php installation Path is enough.
The operating environment of this article: CentOS7.5 system, php7.4.1 version, DELL G3 computer
How to install php on centos 7.5?
CentOS-7.5 Compile and install php-7.4.1
##Travel record: Generally, yum is used to install the package, which is more resistant to source code compilation. After searching on Baidu, it was successfully installed~1. Environment preparationVirtual machine: centos 7Download the source file php-7.4.1:
wget https://www.php.net/distributions/php-7.4.1.tar.gz (Due to half of the download error on the server , change to local download and upload to server scp php-7.4.1.tar.gz root@server ip:/usr/local/)
- Add php user, used to run the php-fpm process
-
cd /usr/local/ useradd php -s /sbin/nologin
- Unzip the php source package
-
tar -zxf php-7.4.1 .tar.gz Install dependency packages -
yum install libxml2-devel sqlite-devel libcurl-devel oniguruma-devel libpng-devel libjpeg-devel freetype-devel libzip-devel openssl-devel -y
cd /usr/local/php-7.4.1
- Compilation parameter reference
-
[root@iZ8vbice4h2bcujon9zc00Z php-7.4.1]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mhash --with-openssl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv --with-zlib --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-bcmath --enable-shmop --enable-sysvsem --enable-gd --with-jpeg --with-freetype --enable-mbregex --enable-mbstring --enable-ftp --enable-pcntl --enable-sockets --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-opcache --enable-fpm --with-fpm-user=php --with-fpm-group=php --without-gdbm --enable-fast-install --disable-fileinfo
[root@iZ8vbice4h2bcujon9zc00Z php-7.4.1]# make && make install
Compilation and installation completed
Start the script: php-7.4.1/sapi/fpm/init. d.php-fpm
cd /usr/local/php-7.4.1/sapi/fpm/ cp init.d.php-fpm /usr/local/php/
php.ini configuration file: php-7.4.8/php.ini-production
cd /usr/local/php-7.4.1 cp php.ini-production /usr/local/php/etc/php.ini
Create php -fpm.conf configuration file
Enter the etc/usr/local/php/etc
[root@iZ8vbice4h2bcujon9zc00Z etc]# pwd /usr/local/php/etc [root@iZ8vbice4h2bcujon9zc00Z etc]# ls php-fpm.conf.default php-fpm.d php.ini [root@iZ8vbice4h2bcujon9zc00Z etc]# cp php-fpm.conf.default php-fpm.conf
[root@iZ8vbice4h2bcujon9zc00Z php-fpm.d]# pwd
/usr/local/php/etc/php-fpm.d
[root@iZ8vbice4h2bcujon9zc00Z php-fpm.d]# ls
www.conf.default
[root@iZ8vbice4h2bcujon9zc00Z php-fpm.d]#
[root@iZ8vbice4h2bcujon9zc00Z php-fpm.d]# cp www.conf.default www.conf
Start php-fpm
Execute init.d.php-fpm to start Script, start php-fpm
[root@iZ8vbice4h2bcujon9zc00Z php]# bash init.d.php-fpm start
edit .bash_profile
vim ~/.bash_profile
Finally, run the command
source ~/.bash_profile
Check the PHP version php -v
Test it: vim test.php
Recommended learning: "
The above is the detailed content of How to install php on centos 7.5. 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

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

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
