Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1513701 - Yum install mod_php installs php-7.1.x but uses php-fpm
Summary: Yum install mod_php installs php-7.1.x but uses php-fpm
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: php
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Remi Collet
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-15 19:30 UTC by Scott Baker
Modified: 2017-11-17 07:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-11-16 06:02:19 UTC


Attachments (Terms of Use)

Description Scott Baker 2017-11-15 19:30:31 UTC
Description of problem:
I want to use mod_php to server PHP 7.1.x via Apache but the module isn't installed correctly.

Steps to Reproduce:
1. yum install apache php mod_php
2. start apache
3. notice in phpinfo() that php is served via php-fpm

Expected results:
phpinfo() says that php is served via Apache 2.0 handler

Additional info:
in /etc/httpd/conf.d/php.conf it tries mod_php5 first, then mod_php7, and finally fails back to php-fpm.

# Redirect to local php-fpm if mod_php is not available
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>

Comment 1 Remi Collet 2017-11-16 06:02:19 UTC
> phpinfo() says that php is served via Apache 2.0 handler

So, that works, as expected.

By default httpd use the threaded MPM, which isn't supported by mod_php, so FPM is used by default.

Comment 2 Remi Collet 2017-11-16 07:23:33 UTC
If you really want to use mod_php you can

- remove php-fpm (which is only a weak dep)

- uncomment the "LoadModule php7_module modules/libphp7-zts.so" but this configuration will NOT be supported

- switch httpd back to prefork MPM

Comment 3 Scott Baker 2017-11-16 16:04:14 UTC
I didn't even know php-fpm was a thing until yesterday when I installed F27. I copied over my F25 config and immediately ran in to PHP errors (I didn't have a module installed). I was changing my php.ini trying to turn on debugging and then restarting Apache (which doesn't work because you have to restart php-fpm instead now). I couldn't for the life of me figure out what the PHP error was because things had changed behind the scenes from mod_php to php-fpm and I didn't get any indication this had happened.

/etc/httpd/conf.d/php.conf still indicates mod_php which further complicated the issue. At *minimum* we should update that php.conf to indicate that mod_php is deprecated now. This is a pretty big change, that requires knowledge of new components (see above) and is not mentioned anywhere in the ChangeSet: 

https://fedoraproject.org/wiki/Releases/27/ChangeSet

Comment 4 Scott Baker 2017-11-16 16:05:05 UTC
Also "yum install mod_php" should not install httpd/php-fpm as this is not the intended outcome from that command.

Comment 5 Remi Collet 2017-11-17 07:27:59 UTC
> /etc/httpd/conf.d/php.conf still indicates mod_php

Improved, but for F28
https://src.fedoraproject.org/cgit/rpms/php.git/commit/?id=45b145421bd286e0344db3f8f00bf10f6f51ca0c

We usually don't change provided configuration in stable version.


Note You need to log in before you can comment on or make changes to this bug.