Having issues getting cacti running on Mac OS 10.4.7

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

Moderators: Developers, Moderators

darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Having issues getting cacti running on Mac OS 10.4.7

Post by darthbator »

Over the last 2 days I have been getting ready to deploy cacti in the office where I work. Currently we don't have any graphic or reporting at all so this is something that we really need. I've managed to successfully setup cacti under debian and ubuntu before so I figured this wouldn't be much different. I was wrong =P

The test box I am running this on is a 1Ghz G4 with 1GB of RAM running OS 10.4.7.

I started off by installing Xcode and darwin ports on the box. I then followed the instructions on http://cacti.darwinports.com/, installing mysql5 +server, then installing cacti and all dependencies. Overall this is what is running.

-Mac OS 10.4.7
-PHP 4.4.1 (installed on the box already)
-mysql5 5.0.24 installed via darwin ports
-Apache 1.3.33 (already installed on the box)

I attempted to use apache 2.2.3 installed via darwin ports however it decided to compile without PHP support so I removed it in favor of just trying to get this running.

the only step I have not currently completed is the editing of the root users crontab. Everything else has been done.

Here's the problem, when I go to 127.0.0.1/cacti/install/index.php I get the following error:


Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /opt/local/share/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 355


it looks to me like it's trying to connect to the SQL db on the wrong socket (/var/mysql/mysqld.sock). I have updated my /private/etc/php.ini.default to reflect mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock, however php doesn't seem to care and wants to access my database through /var/mysql/mysqld.sock anyways =P

I tried adding a symbolic link at /var/mysql/mysqld.sock pointing to /opt/local/var/run/mysql5/mysqld.sock but I still get the same error. Is there something I'm missing? Any help would be most appreciated. Thanks in advance for all of your help.
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

Just a thought, but do you have the DBD::mysql perl modules installed?
Steps #1 and #2 here:
http://www.nmsworld.com/FreeBSD61/Perl.htm

And does your PHP support MySQL connectivity?
Note in step #1 here:
http://www.nmsworld.com/FreeBSD61/PHP.htm
that I compiled PHP against my functioning install of MySQL via:
./configure --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql --with-openssl=/usr --with-mssql=/usr/local --with-zlib --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --enable-exif --with-png-dir=/usr/local/lib --enable-calendar --enable-ftp --with-libxml-dir=/usr/local/lib --with-snmp=/opt/net-snmp/ --enable-fastcgi --enable-magic-quotes --enable-mbstring --enable-sockets --with-gd --enable-gd-native-ttf --enable-soap --enable-sigchild --enable-dbase --enable-filepro --with-mssql --with-bz2 --with-kerberos --with-unixODBC --with-ldap --with-curl --with-curlwrappers --with-flatfile --with-inifile --with-pdo-dblib --with-cdb

You would need to specify where your MySQL resides, in this example, mine is /opt/mysql


I got similar errors in the past when I didn't have basic command line connectivity to MySQL working in the past.
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

Thank you very much for the reply, instruction 2 step 2 showed me that the issue is just where I thought it was, php is pointing to the wrong location for mysqld.sock.

I thought that if you compiled php with a php.ini file changing

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock


in php.ini.default was supposed to update where php was looking for mysqd.sock. Do I really need to remove and recompile PHP in order to repoint it?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

No, you should be able to change the configuration and restart apache to make the changes take effect.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

darthbator: Are you using the "Personal Web Server" built-in with OS X? Or did you compile Apache yourself? Did you install cacti yourself, or did you get it from DarwinPorts/MacPorts?

I had a similar problem to you, I was using the OS X Personal Web Server and it would use the wrong version of PHP; so PHP never knew where to look for the correct MySQL socket file.

I ended up compiling my own copy of MySQL. Let me know if you need any more help...
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

I am using the personal webserver that comes with mac OS. I also have Apache 2.2.3 installed (compiled by me) but I have not gotten PHP working for me. Here's a little look at my phpinfo() running on Apache 1.3.33 (Mac OS "Personal Webserver").

System Darwin Admin.local 8.7.0 Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC Power Macintosh
Build Date Apr 24 2006 19:54:25
Configure Command '/SourceCache/apache_mod_php/apache_mod_php-18.4/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql=/usr' '--with-mysql-sock=/var/mysql/mysql.sock'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /private/etc/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety disabled
Registered PHP Streams php, http, ftp, compress.zlib


So it looks like it's pulling settings from /private/etc/php.ini, so I go to that file and change

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock


so that should cause that to repoint corrent apparently not.

Code: Select all

php -i|grep mysql
Configure Command =>  '/SourceCache/apache_mod_php/apache_mod_php-18.4/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql=/usr' '--with-mysql-sock=/var/mysql/mysql.sock'
mysql
MYSQL_SOCKET => /var/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib/mysql -lmysqlclient 
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => localhost => localhost
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /opt/local/var/run/mysql5/mysqld.sock => /opt/local/var/run/mysql5/mysqld.sock
mysql.default_user => cacti => cacti
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
guess not :( since I seem to be unable to point php to the right place I tried adding a symbolic link in /var/mysql pointing to /opt/local/var/run/mysql/mysqld.sock but that didn't work either.. :(

Just to clarify on this box I have.

Apache 2.2.3 (not running, compiled by yours truly sans php :()
Apache 1.3.33 (Mac OS personal "websharing" using php :))
Mysql 5.0.24 (installed via darwin ports)
PHP 4.4.1 (pre installed on mac OS I would imagine for personal websharing)
Cacti (installed via darwin ports)
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

Can you do something for me?

Make a file called, say, test.php and put it in your htdocs (like /Library/WebServer/Documents or wherever). In the file, just put this line:

<?php
phpinfo();
>

And access the file in your browser. It should show you what version of PHP the web server is looking at, whether or not it has MySQL support, and what socket file it's expecting to see for MySQL.
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

darthbator wrote:I am using the personal webserver that comes with mac OS. I also have Apache 2.2.3 installed (compiled by me) but I have not gotten PHP working for me. Here's a little look at my phpinfo() running on Apache 1.3.33 (Mac OS "Personal Webserver").

System Darwin Admin.local 8.7.0 Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC Power Macintosh
Build Date Apr 24 2006 19:54:25
Configure Command '/SourceCache/apache_mod_php/apache_mod_php-18.4/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql=/usr' '--with-mysql-sock=/var/mysql/mysql.sock'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /private/etc/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety disabled
Registered PHP Streams php, http, ftp, compress.zlib
still the same as when I initially posted it unfortunately the bold part is still not matching what is in the cited configuration file.
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

You said this:
it looks to me like it's trying to connect to the SQL db on the wrong socket (/var/mysql/mysqld.sock). I have updated my /private/etc/php.ini.default to reflect mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock, however php doesn't seem to care and wants to access my database through /var/mysql/mysqld.sock anyways =P
I think you actually need to rename php.ini.default to php.ini.

Can you try that & restart Apache?
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

Yeah I copied php.ini.default to php.ini already, then restarted apache, no dice.
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

Huh. That's weird. I don't know what else to suggest :|

Frankly, I got tired of screwing around with the DarwinPorts of MySQL and Cacti; in the end I compiled Apache, PHP and MySQL from source and was done in about an hour. I'd spent *hours* hacking at the DarwinPorts of those programs trying to get everything to place nice, in the end it just wasn't worth it!
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

I think I'm about at the same place right now I'm going to start removing the darwin ports versions of MySQL and I'm downloading php right now to do my own comilation. I just had one quick question, how exactly do I compile php support for apache 2.2.3 =P

Also this box that I am running on right now is simply my little mac test bed. The box that I am going to be installing this on for good is running OS 10.4.7 Server (Xserve FTW :D :D). However that box has apache2, php 4.4.1 and mysql4 installed. I'm dreading having to compile all these applications from source again on their final destination :(
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

Compiling from source is actually really easy. I'm running my cacti installation on a 10.4.7 client that's only a G4...

Install MySQL: ./configure --prefix=/usr/local && make && make install
Install Apache: ./configure --prefix=/usr/local && make && make install
Install PHP: ./configure --prefix=/usr/local --with-apxs=/usr/local/bin/apxs --with-mysql=/usr/local && make && make install

And that's 90% of the work!
darthbator
Posts: 29
Joined: Wed Sep 27, 2006 7:02 pm

Post by darthbator »

ok so I decided to stop screwing around with darwin ports and just do the compiles. First I downloaded and compiled mysql5 everything goes just grand :)

./configure --prefix=/opt/local && make && make install

next I decided to compile apache2

./configure --prefix=/opt/local/apache2 && make && make install

ok good to go here is where I start running into issues, when i try and compile php

./configure --prefix=/opt/local/php --with-apxs=/opt/local/apache2/bin/apxs --with-mysql=/opt/local

looks good but when i run it I get the following error

checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2

I poked around a little on google and didn't really find anything =( once again more help is apprecaited, thusfar everyone here has been awesome, kind and helpfull :) Just wanted to thank the community for sticking with me on this one and trying to help me out.

A little more info, I decided to just change apxs to apxs2 when configuring php to see what happened. I get a different error this time.

./configure --prefix=/opt/local/php --with-apxs=/opt/local/apache2/bin/apxs2 --with-mysql=/opt/local

that one spits out this error

Sorry, I was not able to successfully run APXS. Possible reasons:

1. Perl is not installed;
2. Apache was not compiled with DSO support (--enable-module=so);
3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs
The output of /opt/local/apache2/bin/apxs2 follows
./configure: line 4219: /opt/local/apache2/bin/apxs2: No such file or directory
configure: error: Aborting


the issue here isn't perl

helpdesk@Admin:/opt/local/php-5.1.5$ perl -v

This is perl, v5.8.8 built for darwin-2level


Oddly enough this seems to compile without issue on my other machine (the G5), but my build of apache appears identical between the two machines......

I'm starting to think that all of the installing and uninstalling of AMP on my test bed is causing issues. right now I'm compiling php and mysql on the live comp so that I have something fresh to work with when i come in on monday morning. thanks again for the help more ideas are always welcome.
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

This one is easy!

You want this:

./configure --prefix=/opt/local/php --with-apxs2=/opt/local/apache2/bin/apxs --with-mysql=/opt/local
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests