Topic: apache not interpreting/executing PHP after install

I have centos version centos-release-7-6.1810.2.el7.centos.x86_64 and apache 2.4.6 (Centos). I installed the remi repo
remi-safe and epel/x86_64. I then ran this to install PHP 7.3:

sudo yum install php73.x86_64 php73-php-cli.x86_64 php73-php-gd.x86_64 php73-php-json.x86_64 php73-php-ldap.x86_64 php73-php-mbstring.x86_64 php73-php-mysqlnd.x86_64 php73-php-odbc.x86_64 php73-php-pdo.x86_64 php73-php-pdo-dblib.x86_64

If I run php -v I get:

PHP 7.3.2 (cli) (built: Feb  5 2019 13:10:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologies

so PHP is installed. But if I try to open a PHP page in the browser, I see the source code. PHP is not being interpreted/executed by apache. What else do I need to do to get apache to recognize the remi PHP?

Thank you!

Re: apache not interpreting/executing PHP after install

You have only installed the CLI SAPI, nothing for the web server

You need

1/ Simple old way: mod_php (php73-php) which works out of the box.

BTW, mod_php only allow a single version, in which case, you don't need the SCL (php73-* packages), but rather the base packages (php-*)

Read: https://blog.remirepo.net/post/2018/12/ … -or-Fedora
and https://blog.remirepo.net/pages/English-FAQ#scl
Also the Wizard instructions (top right link of the page)


2/ Modern way: FPM (php73-php-fpm)

Read: https://developers.redhat.com/blog/2017 … tion-tips/

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: apache not interpreting/executing PHP after install

I tried method 2 and that fixed it. Thank you SO much!!!

Re: apache not interpreting/executing PHP after install

smile

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi