简体   繁体   中英

Centos httpd php version is different from the php version command line

I'm on Centos7 i have enable multiple php versions with remi repo like :

yum-config-manager --enable remi-php56
yum-config-manager --enable remi-php71
yum-config-manager --enable remi-php72
yum-config-manager --enable remi-php73

Then installed the packages :

yum install php{version}
yum install php{version}-php-{extension}

I have setup PHP5.6 like :

sudo update-alternatives --set php /usr/bin/php56

When i make php-v :

PHP 5.6.40 (cli) (built: Sep 29 2020 11:38:05)

But when i'm going to my phpinfo() file i get PHP Version 7.3.23

In centos/RH we can't make :

sudo a2enmod php56 

so i'm confusing and i don't know why httpd interpret version 7.3.23

How could i setup a PHP specific version to httpd?

在此处输入图片说明

You are confused by 2 set of packages:

  • base packages (php-*), 1 repository per version (remi-php##) and where you can install a single (and default) version
  • SCL packages (php##-php-*) design for parallel installation of multiple versions

See the repository FAQ.

If you want to install and run multiple versions, you have to use the SCLs and switch to FPM (instead of mod_php, this is the default way on CentOS 8).

In short, configure each FPM instance to run on a specific socket (network port or UDS), and configure Apache to use the proper version per virtual host, project, directory... using the SetHandler directive.

I recommend you read PHP Configuration Tips

You can also read My PHP Workstation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM