Not getting webpage with cacti running

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
joostman
Posts: 4
Joined: Thu Oct 01, 2015 4:20 am

Not getting webpage with cacti running

Post by joostman »

After an installation of cacti (0.8.8h+ds1-10) at the command-line of a Raspberry Pi 3+ (which had many struggles) I am unable to open the Cacti webpage. Alle I get is a download of a php file if I open http://192.168.178.144:8081/cacti.

I have set up Apache2 at 8081 at the /etc/apache2/ports.conf because the port 80 was taken.

Looking at a reinstall I noticed some strange behaviour at the end:

Code: Select all

root@Raspberry:/etc/apache2# apt-get install --reinstall cacti
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 1,864 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.nl.leaseweb.net/raspbian/raspbian stretch/main armhf cacti all 0.8.8h+ds1-10 [1,864 kB]
Fetched 1,864 kB in 0s (2,883 kB/s)
Preconfiguring packages ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
(Reading database ... 80896 files and directories currently installed.)
Preparing to unpack .../cacti_0.8.8h+ds1-10_all.deb ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
Unpacking cacti (0.8.8h+ds1-10) over (0.8.8h+ds1-10) ...
Setting up cacti (0.8.8h+ds1-10) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dbconfig-common: writing config to /etc/dbconfig-common/cacti.conf
dbconfig-common: flushing administrative password
Running cli/upgrade_database.php as part of package update...
Segmentation fault
apache2_invoke cacti: already enabled
root@Raspberry:/etc/apache2# 
Especially the:
- Segmentation fault
and
- apache2_invoke cacti: already enabled

Any idea what I can do to get the webpage working and start working with Cacti?

This is the dowload file I get when I go to the url:

Code: Select all

<?php
/*
 +-------------------------------------------------------------------------+
 | Copyright (C) 2004-2016 The Cacti Group                                 |
 |                                                                         |
 | 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.                            |
 +-------------------------------------------------------------------------+
 | Cacti: The Complete RRDTool-based Graphing Solution                     |
 +-------------------------------------------------------------------------+
 | This code is designed, written, and maintained by the Cacti Group. See  |
 | about.php and/or the AUTHORS file for specific developer information.   |
 +-------------------------------------------------------------------------+
 | http://www.cacti.net/                                                   |
 +-------------------------------------------------------------------------+
*/

include("./include/auth.php");
include("./include/top_header.php");

api_plugin_hook('console_before');

?>
<table width="100%" align="center">
	<tr>
		<td class="textAreaNotes">
			<strong>You are now logged into <a href="about.php">Cacti</a>. You can follow these basic steps to get
			started.</strong>

			<ul>
				<li><a href="host.php">Create devices</a> for network</li>
				<li><a href="graphs_new.php">Create graphs</a> for your new devices</li>
				<li><a href="graph_view.php">View</a> your new graphs</li>
			</ul>
		</td>
		<td class="textAreaNotes" align="right" valign="top">
			<strong>Version <?php print $config["cacti_version"];?></strong>
		</td>
	</tr>
</table>

<?php

api_plugin_hook('console_after');

include("./include/bottom_footer.php");

?>
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Not getting webpage with cacti running

Post by netniV »

Sounds to me like you have not got PHP installed and enabled under Apache.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
joostman
Posts: 4
Joined: Thu Oct 01, 2015 4:20 am

Re: Not getting webpage with cacti running

Post by joostman »

It seems that I have installed all PHP and Apache connections. Should I do something else?

Code: Select all

root@Raspberry:/etc/apache2# apt-get install php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.0 is already the newest version (7.0.27-0+deb9u1).
php7.0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@Raspberry:/etc/apache2# apt-get install php7.0-fpm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.0-fpm is already the newest version (7.0.27-0+deb9u1).
php7.0-fpm set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@Raspberry:/etc/apache2# apt-get install php7.0-mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.0-mysql is already the newest version (7.0.27-0+deb9u1).
php7.0-mysql set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@Raspberry:/etc/apache2# apt-get install libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libapache2-mod-php7.0 is already the newest version (7.0.27-0+deb9u1).
libapache2-mod-php7.0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@Raspberry:/etc/apache2# 
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Not getting webpage with cacti running

Post by netniV »

Check that you have the apache PHP module actually enabled. The reason why I believe this to be disabled is because you would only receive a downloaded PHP file if apache didn't know there was a script handler for it. That comes via the PHP modules. So, without a script handler, it thinks it is just a file to be downloaded thus you get the raw file rather than a parsed one.

Another way to test is to create a blank file test.php (for example) and put nothing more than

Code: Select all

<?php
phpinfo();
If that downloads rather than displaying PHP information, you definitely don't have PHP enabled.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
joostman
Posts: 4
Joined: Thu Oct 01, 2015 4:20 am

Re: Not getting webpage with cacti running

Post by joostman »

Let me be honest :) I don't really know much about apache2 and php.

I tried some restart commands and put a test.php in /etc/apache2/sites-available and /etc/apache2/sites-enabled/ (didn't know which one) and did a service apache2 restart afterwards.
Unfortunately the http://192.168.178.144:8081/test(.php) did nothing.
The http://192.168.178.144:8081/cacti keeps on giving me a php file.

the http://192.168.178.144:8081 gives me a Apache2 webpage, giving me the indication that Apache2 is working fine.

What I did notice, looking at the php was:

Code: Select all

 root@Raspberry:~# php -v
 Segmentation fault
Looking at the config:

Code: Select all

root@Raspberry:~# dpkg -s php
Package: php
Status: install ok installed
Priority: optional
Section: php
Installed-Size: 12
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: all
Source: php-defaults (49)
Version: 1:7.0+49
Depends: php7.0
Description: server-side, HTML-embedded scripting language (default)
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on Debian's default
 PHP version (currently 7.0).
Anything else I can do / provide as information?

Is there maybe another repo I can add to install cacti? The idea to do an "apt-get --purge remove cacti", then an "apt-get autoremove" and be back at a clean startpoint.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Not getting webpage with cacti running

Post by netniV »

So your test.php file doesn't belong in sites-enabled or sites-available. That's the location for configuration files for apache.

One of those configuration files will say what folder they are serving the site from. They would also say that they are serving the cacti website folder.

I would try running a2enmod php (along with all the other php modules that should be enabled - see the documentation).
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
joostman
Posts: 4
Joined: Thu Oct 01, 2015 4:20 am

Re: Not getting webpage with cacti running

Post by joostman »

Using that only gave me errors:

root@Raspberry:/etc/apache2/sites-available# phpenmod libapache2-mod-php
WARNING: Module libapache2-mod-php ini file doesn't exist under /etc/php/7.0/mods-available
WARNING: Module libapache2-mod-php ini file doesn't exist under /etc/php/7.0/mods-available
root@Raspberry:/etc/apache2/sites-available# phpenmod libapache2-mod-php7.0
WARNING: Module libapache2-mod-php7.0 ini file doesn't exist under /etc/php/7.0/mods-available
WARNING: Module libapache2-mod-php7.0 ini file doesn't exist under /etc/php/7.0/mods-available
root@Raspberry:/etc/apache2/sites-available# phpenmod libphp-adodb
WARNING: Module libphp-adodb ini file doesn't exist under /etc/php/7.0/mods-available
WARNING: Module libphp-adodb ini file doesn't exist under /etc/php/7.0/mods-available

So I removed php7.0 and reinstalled it. I don't know why, but it started to deinstall cacti as well partial.. :-/
After this I did a reinstall of cacti, again with some struggles, but after this was done and the service of apache was restarted... it worked..

Linux is a very nice OS with lots of features, only for the people who don't use it that often or new, these things make it a unusable system. So many versions, so many options, so many questions and for each of them 10 different answers...
Oh wel.. Cacti basic is running, the next struggle to get the config running...

Thanks netniV for the support!
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests