0

I have installed php7.0-fpm and enabled proxy_fcgi mod for Zabbix frontend.

However when I try to get access from any page I get PHP source code of that page instead of normal page.

My configs are the next:

/etc/php/7.0/fpm/pool.d/www.conf
[www]
user= www-data
group = www-data
listen = /run/php/php7.0-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children=10
pm.start_servers =5
pm.min_spare_servers = 2
pm.max_spare_servers = 7
chdir = /usr/share/zabbix/

/etc/apache2/sites-enabled/zabbix.conf 
<VirtualHost *:80>
    Include conf-available/zabbix.conf
    <FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost/usr/share/zabbix/"
    </FilesMatch>
</VirtualHost>

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_worker_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 setenvif_module (shared)
 status_module (shared)

I get only php source code during any page access:

<?php
/*
** Zabbix
** Copyright (C) 2001-2017 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/

require_once dirname(__FILE__).'/include/config.inc.php';

In logs everything is clear, no errors at all.

Could you please help?

user54
  • 299
  • 1
  • 3
  • 12

1 Answers1

0

Changed. Looks like there is error in your configuration file just put SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost" instead of SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost/usr/share/zabbix/".

I check it on my VM and everything is working like it should.

Alexander Tolkachev
  • 4,513
  • 3
  • 14
  • 23