As per older questions,
            such as             href="https://serverfault.com/questions/215261/using-mod-fcgid-instead-of-mod-php">using
            mod_fcgid instead of mod_php and             href="https://serverfault.com/questions/36867/php-as-cgi-or-apache-module">PHP as CGI
            or Apache Module? (and tangentially some             href="https://serverfault.com/questions/22156/what-could-cause-apache2-to-not-run-index-php-files-through-php-fastcgi-handler">other
                        href="https://serverfault.com/questions/110490/local-htaccess-strangely-allowed-running-php-in-cgi-fastcgi-mode-in-apache-under">questions)
            I came to an understanding that running PHP as CGI or FastCGI would make my .php files
            be ran as the owner instead of the apache user
            (user that runs the Apache).
The
            phpinfo(); function states that Server API =
            CGI/FastCGI
However, when I test
            the running user it is still apache ie.             exec('whoami'); ?> returns
            apache.
I've also tried
            what             href="https://serverfault.com/questions/215261/using-mod-fcgid-instead-of-mod-php/215647#215647">Jeremy
            Bouse suggested in a question I've mentioned, but the PHP
            whoami still returns
            apache.
/>
Should the fact that
            phpinfo's "Server API" equals "CGI/FastCGI" be adequate for regular users to run the
            php-files as the owner?
(Does it
            even indicate that PHP is not running with
            mod_php?)
Or are there some admin tasks still to
            be done or something that is probably misconfigured?
Answer
IMHO the (more recent and) best way to run PHP FastCGI is using             href="http://php-fpm.org/" rel="nofollow noreferrer">PHP-FPM, which among
            the many options also permits to use different users for different
            websites.
From the             href="http://php-fpm.org/" rel="nofollow noreferrer">official website:
            
Ability to start workers with
different
uid/gid/chroot/environment
and different php.ini (replaces
safe_mode)
But
            using FastCGI by itself is not enough to use the owner of the file (and there's no such
            thing as "automatically using the owner of the file": you have to actually
            configure it virtual host by virtual host (or as you
            wish).
Comments
Post a Comment