For me, php-fpm was installed automagically when I upgraded from Fedora 25 -> Fedora 27.
I'm glad it did because I didn't know anything about it.  It took a couple of searches to figure
out how to implement my php_values and php_flags under php-fpm.

An update to httpd while I was still on Fedora 25 forced me to use mpm_event.  There was
one gotcha.  mpm_event includes /etc/php-zts.d/* instead of /etc/php.d/*.  PHP started
complaining about datetime using the default.  None of my php configuration in
/etc/php.d/99-mystuff.ini was being pulled in.  So one simple symlink and PHP is a happy
camper:
[0:root@elmo php]$ ls -l /etc/php.d/99-mystuff.ini /etc/php-zts.d/99-mystuff.ini
-rw-r--r--. 1 root root 1268 Mar  1  2017 /etc/php.d/99-mystuff.ini
lrwxrwxrwx. 1 root root   23 Sep 28 05:50 /etc/php-zts.d/99-mystuff.ini -> ../php.d/99-mystuff.ini

Here's a bit of /etc/php.d/99-mystuff.ini:
[PHP]
;short_open_tag = Off           ; gallery 3.0-RC1 requires on
implicit_flush = On
;error_reporting = E_ALL & (~E_DEPRECATED) & (~E_STRICT) & (~E_NOTICE)  ; zabbix
;error_reporting = E_ALL & ~E_DEPRECATED        ; production
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT     ; production
display_errors = On
display_startup_errors = On
log_errors = On
track_errors = On
upload_max_filesize = 10M
register_argc_argv = On
register_long_arrays = Off

;memory_limit = 128M            ; for openx
;memory_limit = 1024M           ; for SiteA conversion
memory_limit = 4096M            ; for SiteB merge
;memory_limit = 256M            ; for large PHPExcel spreadsheets (now in <Directory>
;max_execution_time = 300       ; for zabbix (now in <Directory>
;post_max_size = 16M            ; for zabbix (now in <Directory>

[Date]
date.timezone = America/New_York        ; Eastern
;date.timezone = America/Chicago                ; Central
;date.timezone = America/Denver         ; Mountain
;date.timezone = America/Phoenix        ; Mountain (no DST)
;date.timezone = America/Los_Angeles    ; Pacific
;date.timezone = America/Anchorage      ; Alaska
;date.timezone = America/Adak           ; Hawaii-Aleutian
;date.timezone = Pacific/Honolulu       ; Hawaii-Aleutian (no DST)


[Session]
session.gc_probability = 5
;session.gc_maxlifetime = 86400 ; 1 day
session.gc_maxlifetime = 172800 ; 2 days

Glad you got it fixed.
Bill

On 1/28/2018 6:45 PM, Emmett Culley wrote:
On 01/26/2018 03:30 AM, Bill Shirley wrote:
I posted a reply four days ago.
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org/thread/LHUCQDLCFP5NK6AQSPNSCOGKRYGKKTID/
Did you try it?

Use mpm_event and php-fpm and .user.ini.

Bill

On 1/25/2018 10:44 AM, Emmett Culley wrote:
On 01/24/2018 05:14 PM, Rick Stevens wrote:
On 01/24/2018 03:09 PM, Emmett Culley wrote:
After a recent upgrade some development web sites served from my workstation stopped working.  I've narrowed it down to the php_value auto_prepend_file directive not working.

This is in the /etc/httpd/conf.d/csite.conf file:

<Directory /var/dev/csite>
    Require all granted
    AllowOverride none
    php_value error_log /var/dev/logs/caiet_error_log
    php_value auto_prepend_file /var/dev/csite/site/host-map.inc
</Directory>

The file /var/dev/csite/site/host-map.inc does not get loaded and this causes a 500 error.   I've tried configuring apache as MPM = "prefork" (the new default seems to be "event"), but that made no difference.

Note that all five other sites that use the auto_prepend_file directive no longer work either.  All other development sites on my workstation work as expected.

Any ideas where to look further would be appreciated.  Fedora 27 is fully up to date.
Check your selinux logs (or use sealert). Odds are that selinux is
blocking access to /var/dev/csite/site since it's not part of the
standard /var/www/* paths that Apache is permitted to access (unless you
labeled the /var/dev/csite stuff with "httpd_sys_content_t" or you've
disabled selinux or put it in permissive mode).

Note that using PHP as a module in Apache using anything other than
the prefork MPM isn't a good idea. The "event" or "worker" MPMs put
Apache in multithreaded mode (generally a good thing), and while PHP
itself is multithread-safe, MANY of the libraries that PHP uses are not.

For event or worker MPMs, you should change over to php-fpm where PHP
runs as a separate process rather than as part of Apache. Apache talks
to it via either a local TCP port (typically 127.0.0.1:9000) or
a Unix-domain socket. You will need to modify your Apache configs
appropriately to use php-fpm, but the speed increase and decreased
load on your machine would be a benefit.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
Thanks for the response.  Selinux is disabled and I've set MPM to prefork, and still, the php_value directives are ignored.

I've tried putting the directives in the .htaccess file and setting AllowOverride to all, and still the php directives are ignores.  And yet all of the PHP sites that do not need those directives work just fine.

Note that if I misspell a PHP directive apache fails to start as you would expect.  So, I know the directives are getting read.  They are just ignored.

I'll try putting the directive in the php.ini file to see if it still ignored.  Of course that wouldn't work long term as each site needs that directive to be specific to that site.

So, when will PHP be multithread safe?  Is there a list of libraries or methods that are not multithread capable?

Emmett
Bill,

I didn't see your reply.  Thanks for trying again.  That fixed the problem. 

I am not sure why php-fpm is suddenly getting used on my workstation.  I did not install it, nor did I enable it in systemd.  A couple of days ago I was modifying one of the sites that stopped working, and all was working as expected.  Then suddenly php-fpm is running the show and none of those sites worked.

Well, at least this forced me to find about apache multithreaded,  

Can I assume that it is now completely safe to run PHP in apache multithreaded mode?

Emmett
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-leave@lists.fedoraproject.org