[BlueOnyx:21203] Re: php 7.0 user

Michael Stauber mstauber at blueonyx.it
Tue Jul 18 15:29:29 -05 2017


Hi Chris,

> Did you perhaps mean that PHP-FPM will ignore the php.ini file?

Let us ignore .htaccess for a moment and look how the different PHP
implementations get their PHP Vsite specific settings imprinted:

- "DSO" and "DSO + mod_ruid2":

They use the stock php.ini applicable to your selected PHP version. But
the Apache VirtualHost container gets enriched with the PHP settings
defined for your Vsite such as open_basedir, memory limits, timeouts and
such. These settings in the VirtualHost container then override whatever
identical options were defined in the php.ini.

- suPHP:

When suPHP is enabled, we copy this PHP's stock php.ini to the Vsite's
root directory and run a search and replace on it to apply all the
settings relevant to the Vsite.

- PHP-FPM:

Each PHP-FPM instance has it's own config file where UID/GID of the
process and all relevant PHP settings are defined. So when PHP-FPM is
configured for a Vsite, we create this config file and write all the
relevant PHP settings that are applicable for this Vsite into that
config file.

The net result is the same:
===========================

Every form of PHP honors the PHP settings applicable for this particular
Vsite as configured in the GUI and it does that in the way that is best
suited for that particular form of PHP implementation.

> Because I believe that the .htaccess remains intact and usable under
> any of BlueOnyx PHP implementation that I've tried.  Perhaps I've
> missed something massive?

My bad! I forgot that I had fixed this quite some time ago. It was such
a bloody nuisance that it must have left some lingering trauma with me. ;-)

In the past it was like this: Whenever PHP-FPM was activated we
unconditionally piped every file through the FCGI socket to let it be
parsed by the PHP-FPM instance set up for that particular Vsite.

That way Apache would never get to see any .htaccess file and its
contends would be ignored.

Eventually this was changed to this two-liner in the VirtualHost
container with which we activate PHP-FPM:

RewriteCond /home/.sites/28/site1/web/%{REQUEST_FILENAME} -f

RewriteRule ^/(.+.php(/.*)?)$
fcgi://127.0.0.1:9011/home/.sites/28/site1/web/$1 [L,P]

As you can see: It now checks if a filename ends with *.php (or similar)
and only then it would pipe it via fcgi://127.0.0.1:<PORT> to the
PHP-FPM instance set up for that particular Vsite.

This leaves everything else to be handled normally by Apache and
.htaccess works again. On my devel-box I actually have a PHP-FPM enabled
site with some mod_rewrite rules in it and they work just fine.

I still wonder why I forgot that I had fixed it, though.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list