# apache segfault w/ (only) cacti

## alterself.com

my apache segfaults (just the individual process) when I visit my cacti site. this IS a new install, everything fully up to date as of 20060409 with ACCEPT_KEYWORDS="~x86". The db and the config file are setup properly.

I have two other cacti installs in the same config at work, w/ no issues. (their cacti installs were upgrades, not new installs as this one)

if more info is needed, please let me know.

thanks!

----------

## ali3nx

could you post emerge info?

----------

## alterself.com

i would have to assume u mean this:

```
brutus backups # emerge --info

Portage 2.1_pre7-r4 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.4-r1, 2.6.16-gentoo i686)

=================================================================

System uname: 2.6.16-gentoo i686 Pentium III (Coppermine)

Gentoo Base System version 1.12.0_pre17

dev-lang/python:     2.3.5-r2, 2.4.2-r1

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.59-r7

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2

sys-devel/binutils:  2.16.1-r2

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.11-r3

ACCEPT_KEYWORDS="x86 ~x86"

ACCEPT_LICENSE=""

ARCH="x86"

AUTOCLEAN="yes"

BASH_ENV="/etc/spork/is/not/valid/profile.env"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O3 -march=pentium3 -msse"

CHOST="i686-pc-linux-gnu"

CLEAN_DELAY="5"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/env.d"

CVS_RSH="ssh"

CXXFLAGS="-O3 -march=pentium3 -msse"

DISTDIR="/usr/portage/distfiles"

EDITOR="/usr/bin/vim"

ELIBC="glibc"

EMERGE_WARNING_DELAY="10"

FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"

FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P ${DISTDIR} ${URI}"

GCC_SPECS=""

GENTOO_MIRRORS="ftp://gentoo.mirrors.tds.net/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://adelie.polymtl.ca/ http://open-systems.ufl.edu/mirrors/gentoo"

HOME="/root"

HOSTNAME="brutus"

INFOPATH="/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.16.1/info:/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info"

KERNEL="linux"

LESS="-R -M --shift 5"

LESSOPEN="|lesspipe.sh %s"

LOGNAME="root"

MAIL="/var/mail/root"

MAKEOPTS="-j3"

MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.16.1/man:/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man"

OLDPWD="/root/backups"

PAGER="/usr/bin/less"

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.4.6"

PKGDIR="/usr/portage/packages"

PORTAGE_ARCHLIST="ppc s390 amd64 ppc64 x86-fbsd m68k arm sparc sh mips ia64 alpha ppc-macos hppa x86"

PORTAGE_BINHOST_CHUNKSIZE="3000"

PORTAGE_CALLER="emerge"

PORTAGE_GID="250"

PORTAGE_INST_GID="0"

PORTAGE_INST_UID="0"

PORTAGE_MASTER_PID="17790"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"

PORTAGE_RSYNC_RETRIES="3"

PORTAGE_TMPDIR="/tmp"

PORTAGE_WORKDIR_MODE="0700"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

PORT_LOGDIR="/var/log/emerge"

PRELINK_PATH=""

PRELINK_PATH_MASK=""

PWD="/root/backups/backups"

PYTHONPATH="/usr/lib/portage/pym"

RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P ${DISTDIR} ${URI}"

RPMDIR="/usr/portage/rpm"

SHELL="/bin/bash"

SHLVL="1"

SSH_CLIENT="12.218.48.136 53573 22"

SSH_CONNECTION="12.218.48.136 53573 12.207.138.13 22"

SSH_TTY="/dev/pts/3"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

TERM="xterm"

USE="x86 apache2 berkdb crypt cups dba fastbuild gd gdbm gif gpm imagemagick jpeg libwww mppe-mppc mysql nagios-dns nagios-game nagios-ntp nagios-ping nagios-ssh ncurses nptl nptlonly pam perl php png python readline samba snmp sse sse2 ssl tcpd tiff unzip vhosts virus-scan zip elibc_glibc kernel_linux userland_GNU"

USER="root"

USERLAND="GNU"

USE_EXPAND="DVB_CARDS ELIBC FCDSL_CARDS FRITZCAPI_CARDS INPUT_DEVICES KERNEL LINGUAS USERLAND VIDEO_CARDS"

USE_EXPAND_HIDDEN=""

USE_ORDER="env:pkg:conf:defaults"

XARGS="xargs -r"

_="/usr/bin/emerge"
```

----------

## otherdave

I'm seeing the same problem (the segfault is logged in error_log):

[Wed Apr 19 22:33:44 2006] [notice] child pid 8569 exit signal Segmentation fault (11)

[Wed Apr 19 22:33:53 2006] [notice] child pid 8671 exit signal Segmentation fault (11)

[Wed Apr 19 22:34:31 2006] [notice] child pid 8774 exit signal Segmentation fault (11)

I'll let you know if I get anything working. I'm sure I upgraded something and didn't pay attention to what I was doing. Maybe a revdep-rebuild will take care of it.

----------

## alterself.com

been there, tried that. on one server it works, on another it dont...no reason whatsoever.

----------

## otherdave

The thing that's bizarre to me is that it's not just php. I put a web-site in my user directory (/home/dave/public_html) with an index.php file that just had a call to <? phpinfo() ?> and that works fine. There's something in cacti I guess.

revdep-rebuild did nothing, nor did upgrading to ~86 php and rebuilding apache.

----------

## otherdave

I found a post on the cacti forums here:

http://forums.cacti.net/about12805.html&highlight=apache+segfault but so far no one seems to have a solution.

----------

## alterself.com

well that is intersting...no post there for about a week either...this is a very odd problem indeed

----------

## otherdave

Ok, I have no idea if this was the problem or not, but when I fixed it, cacti started working.

I noticed that my mysql wasn't working. I have a local phpBB installation that I use for testing stuff. It was broken. /var/log/mysql/mysqld.err had the following:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 8388608 bytes

InnoDB: than specified in the .cnf file 0 5242880 bytes!

060420 23:27:29 [ERROR] Can't init databases

060420 23:27:29 [ERROR] Aborting

So I googled some stuff and it said that I could delete the ib_logfile0 and ib_logfile1.

I didn't delete them, but rather moved them elsewhere. I was then able to re-start mysql. Then my phpBB came up then I tried Cacti and it came up. Incredibly strange. Maybe this applies to you too?

----------

## alterself.com

nope. no joy...  :Sad: 

----------

## M.u.r.k.

Hello,

any news on this. I am having the same problem on x86.

Thank you.

Markus

----------

## otherdave

Mine has been working great since fixing MySQL. Have you made sure your MySQL installation is good?

----------

## M.u.r.k.

 *otherdave wrote:*   

> Mine has been working great since fixing MySQL. Have you made sure your MySQL installation is good?

 

MySQL is working fine. Other Services and Scripts use it without problems.

----------

## alterself.com

 :Shocked: 

wow...this is really disappointing. no info yet?   :Confused: 

----------

## guid0

same problem here.

two different setups. both on a 32bit p4 machine and on a amd64 box.

 :Sad: 

----------

## alterself.com

yea...im still here...same problem as before. i have 2 @ work that are perfectly fine, one @ home that is fine, but the one offsite is not....

apparently this is not a very popular issue? ...quite disappointed actually

----------

## guid0

Actually i simply posted to stay updated on this issue.

I dont have any working version at all  :Sad: 

Could you please post me your working version or did you pull it entirely from portage?

I will probably drop php5 and get php4 once i have some more time.

Will let you know if it brings anything.

Cheers,

guid0

----------

## guid0

yep

ditched php5 and emerged the masked php4 and mod_php-4

cacti now works.

in package.mask :

```
 >=dev-lang/php-5
```

in package.unmask :

```
 >=dev-php/php-4

>=dev-php/mod_php-4
```

hope this works for you too.

----------

## llongi

 :Sad: 

Don't install dev-php/php and/or dev-php/mod_php, they have exactly 12 days to live still, then they will definitively disappear from Portage.

If you want to use PHP4, just emerge =dev-lang/php-4* and you'll get the latest, security-fixed, PHP4 version! (dev-lang/php-4.4.2-r2)

----------

## hexa

do you have threaded version of apache 2?

If so try using nonthreaded, ie prefork, mybe it will work  :Wink:  Some of my instalations would crash randomly when using worker module.

----------

## alterself.com

i am "unstable"  :Very Happy:  (~x86 anyway)

dev-lang/php-5.1.4

net-www/apache-2.0.55-r2 (non threaded)

net-analyzer/cacti-0.8.6h_p20060108-r2

BUT, as i said, i have this EXACT configuration on 2 other boxes working fine. To me this has to be something on that machine...but what?

----------

## krzyh

The same, but...

I've updated my box to php5 cacti dosen't work when in localhost/htdocs/cacti/ and the strangest is this that in localhost/htdocs/cacti_old my old 0.8.6h moved from old server works fine.

With this version cacti-0.8.6h_p20060108 (just copied from old box) there is no problem. 

```

dev-lang/php-5.1.4  USE="apache2 berkdb cli crypt ftp gd hardenedphp imap ldap mysql ncurses nls pcre pic readline sasl session snmp sockets sqlite ssl threads truetype unicode xml zlib"

and

net-www/apache-2.0.55-r1  USE="apache2 ldap ssl threads"

```

Ok I've found where was problem in my box. I forgot to change in include/config.php 

```

$database_type = "mysql";

$database_default = "cactidb";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cacti";

$database_port = "3306";

```

There is no problem right now.

----------

## Caffeine

Howdy - does anybody know if there's a solution to this problem?

Cheers,

Caff

----------

## alterself.com

 *Caffeine wrote:*   

> Howdy - does anybody know if there's a solution to this problem?
> 
> Cheers,
> 
> Caff

 

well, my fix was to edit the config.php file BEFORE trying to goto the web interface...hope that helps...

-drew

----------

## deurk

Having the same troubles here is what I have so far:

```
*  dev-lang/php

      Latest version installed: 5.1.4-r6

*  net-www/apache

      Latest version installed: 2.0.58-r2

*  net-analyzer/cacti

      Latest version installed: 0.8.6h_p20060108-r2 
```

```
[Tue Aug 22 10:32:15 2006] [notice] child pid 31291 exit signal Segmentation fault (11) 
```

dev-lang/php-5.1.4-r6  USE="apache2 bzip2 cli exif ftp gd gdbm iconv imap mysql mysqli nls pcre readline session snmp spell ssl truetype unicode xml xmlreader xmlrpc xmlwriter zip zlib -adabas -apache -bcmath -berkdb -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -crypt -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -gd-external -gmp -hardenedphp -hash -hyperwave-api -informix -inifile -interbase -iodbc -ipv6 -java-external -kerberos -ldap -libedit -mcve -memlimit -mhash -ming -msql -mssql -ncurses -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -postgres -qdbm -recode -reflection -sapdb -sasl -sharedext -sharedmem -simplexml -soap -sockets -solid -spl -sqlite -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -vm-goto -vm-switch -wddx -xpm -xsl -yaz"

net-www/apache-2.0.58-r2  USE="apache2 ssl -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker -no-suexec -static-modules -threads"

Any clues? MySQL is fine, tried the account with other apps and they are working.

----------

## alterself.com

my problem was that i had not created the mysql db's and populated them w/ the sql file.

cacti should know to handle that better...

----------

## deurk

As I said, MySQL is fine  :Smile: 

----------

## alterself.com

then your problem is different than mine...

hrmpf...good ol cacti...

----------

## deurk

Still can't make the damn cacti work.

Anyone have any idea?

----------

## Halcy0n

deurk, your problem most likely does like with mysql, because that's where mine was.  Check to make sure that the username and password you are specifying in the conf file is correct on the mysql side as well.  My problem was that I put cactiuser in the file, but cacti in mysql.

----------

## ovaron_gen

in cacti/lib/database.php, function db_fetch_row

insert "if ($log)" (without quotes) before: cacti_log("ERROR: SQL Row Failed \""......

there is an endless loop till segfault if the dbsettings are wrong ... cacti_log -> db_fetch_row -> cacti_log -> db_fetch_row ....

maybe someone can tell the cacti guys that, i couldn't create a forum account

```

function db_fetch_row($sql, $log = TRUE) {

        global $cnn_id;

        if ($log) {

                if (read_config_option("log_verbosity") == POLLER_VERBOSITY_DEBUG) {

                        cacti_log("DEBUG: SQL Row: \"" . str_replace("\n", "", str_replace("\r", "", str_replace("\t", " ", $sql))). "\"\n", FALSE);

                }

        }

        $cnn_id->SetFetchMode(ADODB_FETCH_ASSOC);

        $query = $cnn_id->Execute($sql);

        if ($query) {

                if (!$query->EOF) {

                        return($query->fields);

                }

        }else{ if ($log)

                cacti_log("ERROR: SQL Row Failed \"" . str_replace("\n", "", str_replace("\r", "", str_replace("\t", " ", $sql))) ."\"", FALSE);

        }

}

```

----------

## deurk

I will make sure my settings are correct.

And I will forward that to cacti devs  :Smile: 

----------

## deurk

Ok... I just tried root and it worked (had to refill the base once though, it was empty). Then changed back to the one I defined earlier and now it works.

I could swear I did it right.

Oh well.

Thanks again.

----------

## carpenike

I had the same problem...

All I had to do to fix it was to change my config.php file to use the mysql root user....

Not the best of solutions, but it's all a local lan, so not that big of a deal...

----------

## deurk

Did you try to change the user back to something else than root after that?

----------

