search
HomeBackend DevelopmentPHP ProblemHow to install php on centos 7.5

How to install php on centos 7.5

Jan 26, 2022 am 10:54 AM
centosphp

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.

How to install php on centos 7.5

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 preparation

Virtual machine: centos 7

Download 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/)

2. Start installation

    Add php user, used to run the php-fpm process
  1. cd /usr/local/
    useradd php -s /sbin/nologin

How to install php on centos 7.5

    Unzip the php source package

  1. tar -zxf php-7.4.1 .tar.gz How to install php on centos 7.5
  2. Install dependency packages
  3. 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
  1. [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

How to install php on centos 7.5Compilation and installation completed

How to install php on centos 7.5

3. Copy the relevant configuration files to the php installation path

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

How to install php on centos 7.5

##Enter the php-fpm.d directory under the php installation path , rename the files inside

[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

How to install php on centos 7.5Start php-fpm
Execute init.d.php-fpm to start Script, start php-fpm

[root@iZ8vbice4h2bcujon9zc00Z php]# bash init.d.php-fpm start

How to install php on centos 7.5edit .bash_profile

vim ~/.bash_profile

How to install php on centos 7.5Finally, run the command

source ~/.bash_profile
Check the PHP version php -v

Test it: vim test.phpHow to install php on centos 7.5

How to install php on centos 7.5

How to install php on centos 7.5Recommended learning: "

PHP Video Tutorial

"

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!

Statement
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

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

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.