1

I've just installed php 8 (following https://rpms.remirepo.net/wizard/) on my VPS running CentOS 7. While in the CLI it shows that PHP 8 is available, when I serve a webpage with phpinfo() it still shows php 7.

PHP 8.0.7 (cli) (built: Jun  1 2021 18:43:05) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies

Also when I check with composer it shows php 8

Running 2.1.3 (2021-06-09 16:31:20) with PHP 8.0.7 on Linux / 3.10.0-1127.18.2.el7.x86_64

But via a webpage displaying phpinfo() it shows

PHP Version 7.2.34

The commands I ran (from the remi wizard) to install PHP are:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum install yum-utils

yum  install php80

Next I tried restarting apache with 'sudo systemctl restart httpd.service' but this didn't resolve. I suspect that somehow I need to still switch between both PHP versions but I don't know if that's the cause or how to do so.

Some more info

$ which php
/usr/bin/php

$ whereis php
php: /usr/bin/php /usr/lib64/php /etc/php.ini /etc/php.d /usr/include/php /usr/share/php /usr/share/man/man1/php.1.gz

whereis php80
php80: /usr/bin/php80

$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov 16 2020 16:18:20

My search further (thnx t3ln3t) brought me to the apache config files, which references a php7 config file which then points to 'libphp72.so'. So I am guessing that eventually that needs to point to php8. But although php8 is installed, I don't see a libphp80.so file.

Thank you for any guidance on what I should do next to make the apache config point to the newly installed php8 version.

5
  • @MichaelHampton I've updated the question with the package installed. Not sure if I restarted PHP, which command would that be? Jun 13, 2021 at 13:17
  • I did install PHP8 Jun 13, 2021 at 13:17
  • I reviewed your edit but it doesn't show anything about you installing PHP 8. How did it get onto your system? Jun 13, 2021 at 13:59
  • I've installed php 8 through the commands generated via rpms.remirepo.net/wizard. I added each command I ran in the question. Jun 13, 2021 at 14:16
  • Undo the installation of php80 and start over. You selected "Multiple versions simultaneously" and you should have selected "Default / Single version (simplest way)". Jun 13, 2021 at 14:27

1 Answer 1

2

This is likely a case of two versions installed on your system. If you look at the rpms you have installed, you will likely find php7 has been installed and lives someplace else on the system. Very likely in the search path apache uses to find things. Also, review your apache configuration file. mod_php is very likely named and a full path to that module is present.

#rpm -qa | grep php

This command should show you all installed versions of php that were installed using rpms. If php7 was installed from a source distribution or tarball someone made or found, this is going to SUCK!!! If you find php7 rpms, schedule some maintenance (down time) for your website, remove the old php rpms and then restart apache. Again, take care to look at your apache config files as mod_php is likely named and a full path is present. You will want to modify that to let apache know to look at the newer version of php.

6
  • Thnx, that command isn't working for me, but the apache config located at /etc/httpd/conf/httpd.conf indeed points to conf.modules.d/*.conf in which 15-php72-php.conf is present. So guessing that I need a change there to point to php80 instead of php72?!? Jun 13, 2021 at 19:14
  • make sure you save a copy of that config file unmodified before you go making modifications. At least you can put it back on working php7 should your modifications not work for some reason. Otherwise I would say yes.
    – t3ln3t
    Jun 13, 2021 at 19:49
  • You probably need to remove mod_php (php72-php package) and install proper version (php80-php), btw as said by Michael Hampton, simpler to follow the Wizard instructions for "single version", unless your really want multiple version. Jun 14, 2021 at 9:25
  • And if you need multiple version, I recommend you switch to FPM and read developers.redhat.com/blog/2017/10/25/php-configuration-tips Jun 14, 2021 at 9:26
  • Thnx @RemiCollet I started out by installing the single version, but the result was the same. It seems that previously in the apache config some particular config was done with deep symlinking to the php version. Trying to untangle & resolve that now. Jun 15, 2021 at 7:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .