Ubuntu 16.04.1 Apache/2.4.18 PHP 5.6.32

I am trying to make a separate pool for each virtual host. So I created site1.config in /etc/php/5.6/fpm/pool.d:

user = site1
group = site1
listen = /var/run/php/php5.6-fpm-site1.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

When I restart the FastCGI server, I see the processes being created. So far, so good! Then I create /etc/apache2/sites-available/site1.config:

<VirtualHost *:80>
    ServerName site1.com
    ServerAlias www.site1.com

    ServerAdmin webmaster@localhost
    DocumentRoot /data/site1/html
    <Directory /data/site1/html>
            AllowOverride All
            Options -MultiViews
            Require all granted

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <IfModule mod_fastcgi.c>
        AddType application/x-httpd-fastphp5 .php
        Action application/x-httpd-fastphp5 /php5-fcgi
        Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi-site1
        FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-site -socket /var/run/php/php5.6-fpm-site1.sock -pass-header Authorization

After restarting Apache I can access the virtual host at site1.com but in the environment section of phpinfo I see that the user is still www-data. Any ideas? Thanks in advance.

  • Are you sure you're running php 5.6? Ubuntu 16.04 has php 7.0. Which would put the config at /etc/php/7.0/fpm/pool.d/
    – virullius
    Jan 11 '18 at 18:09
  • @mjb2kmn Yes, I am :) Jan 11 '18 at 19:27
  • you don't need to check environment, a simple ps should tell you which user is running the fpm pool. site1 user exists?
    – ezra-s
    Jan 12 '18 at 0:29
  • @ezra-s Yes, 2 processes with site1 user were created right after I restarted the fpm service. But this, in my opinion, doesn't mean Apache is using this particular pool. I've tested it by allowing only site1 to read the phpinfo.php file. I received 500 error from Apache. Jan 12 '18 at 7:49
  • and what does the error log say when you receive 500? If the answer is "nothing" then the error is not from apache but from php.
    – ezra-s
    Jan 12 '18 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.