search
HomeBackend DevelopmentPHP ProblemHow to install php yum to a specified directory

How to install php yum in the specified directory: 1. Execute the "yum install" command to install; 2. Modify "/usr/local/php/etc/php.ini"; 3. Run "php-fpm" ; 4. Configure alias; 5. Specify the path of PHP scanning extension.

How to install php yum to a specified directory

The operating environment of this tutorial: Centos7 system, PHP version 8.1, Dell G3 computer.

How to install php yum to a specified directory?

Centos7 Yum Install PHP to the specified directory

Sometimes it is necessary to install multiple versions of PHP on the server, but compilation and installation cannot use yum to install dependencies and To maintain extensions, use this method to install and configure multiple PHP environments. The first PHP environment on the server can be installed directly using yum, and then the second, third or even more need to be installed using the following commands and configured

Installation command

yum install -c /etc/yum.conf --installroot=/usr/local/php/ --releasever=/ --enablerepo=remi-php71 php php-opcache php-mbstring php-mcrypt php-fpm php-cli php-xml php-redis php-mysqlnd php-pdo php-phalcon php-common php-json

Note:

installroot Select the directory to be installed

php and php extension by yourself

The remaining parameters are fixed

Configuration

Modify /usr/local/php/etc/php.ini

Modify /usr/local/php/etc/php-fpm.conf

Modify /usr/local /php/etc/php-fpm.d/*.conf

To run php-fpm

, you need to modify the ExecStart value of the php-fpm.service file first. For:

ExecStart=/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini --fpm-config /usr/local/php/etc/php-fpm.conf --nodaemonize

The path is the path for custom installation, please modify it yourself

php command line

You need to bring the configuration every time you run the php command The file path seems particularly troublesome, so it is recommended to configure alias

alias php7='PHP_INI_SCAN_DIR=/usr/local/php/etc/php.d /usr/local/php/bin/php -c /usr/local/php/etc/php.ini'

After configuring alias, you can directly use the alias to execute php commands on the command line, such as: php7 -v

How to install php yum to a specified directory

The purpose of setting PHP_INI_SCAN_DIR=/usr/local/php/etc/php.d in alias is to specify the path of PHP scanning extension, which must be set

Recommended learning: "PHP Video Tutorial

The above is the detailed content of How to install php yum to a specified directory. 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 Article

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool