Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Help- install - cannot connect to mySQL

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific
Author Message
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Tue Aug 05, 2008 11:51 am    Post subject: Help- install - cannot connect to mySQL Reply with quote

hello!

install cacti on OpenBSD 4.3.
Cacti 0.8.7b

i believe i got all pieces installed correctly following the various documents I found for doing this. Apache is running and i can get to the default Apache web page. Mysql is running and I can connect to the cacti DB using the creds that are in the include/config.php. i can show 'tables' and see the cacti DB tables.

When I try to go to http://servername/cacti, i get "FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php' "

Showing php gives an error about mysql already loaded.
PHP Warning: Module 'mysql' already loaded in Unknown on line 0

I've Googled about every error I could think of. most say to check the name in the config.php, but like I stated above, i can use that in sqladmin to connect to and display tables for the cacti DB.

Any help would be appreciated.

Thanks!
PS
Back to top
echouin12



Joined: 08 Jul 2008
Posts: 48
Location: MSU High Energy Physics

PostPosted: Tue Aug 05, 2008 12:19 pm    Post subject: Reply with quote

I don't know if this is your issue but it is mine, when I
#service mysqld status
mysqld is stopped

So mysql is off and so it has to be turned on

#service mysqld start
Starting Mysql [OK]

That should be your first step in debugging your error, it worked for me but you may have something else wrong. Hopefully it helps though!
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Tue Aug 05, 2008 12:25 pm    Post subject: Reply with quote

Thanks for trying. mysql is running. if it was not I would not be able to connect using the mysql shell and display the cacti DB tables.

thanks!!
PS
Back to top
technick



Joined: 05 Aug 2008
Posts: 6

PostPosted: Tue Aug 05, 2008 12:57 pm    Post subject: Reply with quote

Have you checked to make sure mysql is listening on a local port? I assume your connecting to "localhost", do you run a firewall that might be filtering 3306 on localhost?

The only other thing I can think of is turning on error reporting inside php and watch the verbose output.
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Tue Aug 05, 2008 1:29 pm    Post subject: Reply with quote

thanks!!

servenamen:/$ netstat -an | grep 3306
tcp 0 0 *.3306 *.* LISTEN

I did not allow external connections to mysql when i ran the post install config. Only local. Maybe that broke it??

pf not running.

how do i turn on php debugging?
Back to top
technick



Joined: 05 Aug 2008
Posts: 6

PostPosted: Tue Aug 05, 2008 3:04 pm    Post subject: Reply with quote

create a page inside your apache http docs root directory and insert the following

<php
phpinfo();
?>

Check to make sure php has mysql support.

The php error reporting / debugging is found in the php.ini file.
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Fri Aug 08, 2008 10:28 am    Post subject: Reply with quote

Well I created the file restarted apache and just got more error log entries saying mysql already loaded.

I checked and the php5 mysql pkg is installed. here are all the php pkgs I installed:

/var/db/pkg/php5-core-5.2.5p2
/var/db/pkg/php5-mysql-5.2.5
/var/db/pkg/php5-mhash-5.2.5
/var/db/pkg/php5-mcrypt-5.2.5
/var/db/pkg/php5-imap-5.2.5
/var/db/pkg/php5-xmlrpc-5.2.5
/var/db/pkg/php5-gd-5.2.5
/var/db/pkg/php5-curl-5.2.5
/var/db/pkg/php5-snmp-5.2.5
/var/db/pkg/php5-fastcgi-5.2.5p0


Still getting same error. can't connect to SQL server on localhost.

Any other suggestions?
Thx
PS
Back to top
N3NCY
Cacti User


Joined: 22 Sep 2005
Posts: 242
Location: Landenberg, PA

PostPosted: Sat Aug 09, 2008 7:31 am    Post subject: Reply with quote

Your include/global.php contains MySQL connection credentials.

For example:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "mysql";
$database_password = "mysqlpassword";
$database_port = "3306";

Test these credentials from the command line:
mysqladmin -u mysql --password=mysqlpassword ping
mysqld is alive

You will need to use the correct username and password for your system.
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Mon Aug 11, 2008 8:33 am    Post subject: Reply with quote

Thanks!

You said the inculde/global.php file, but the install docs say include/config.php. I have the correct settings in config.php, and I can use them to sucessfully ping and to also logon and view table names in mysql.

I was following the install instructions on the website, but I found that the install directions from the actual install are sligthly different. My bad for thinking the install directions were the same.

The Apache config is slightly different from the directions on the website.

I am fairly new to OBSD and Apache having worked for many years in Windows but i am trying.

I have this question.

in the install docs it says to add the following to the httpd.conf:

"# Load config files from the config directory "/etc/httpd/conf.d".
Include conf.d/*.conf"

I cannot find this line anywhere in the file. Am I missing something?

And when I changed the php5.conf file to include this info:

"# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
DirectoryIndex index.php"


First i had to find the libphp5.so file because it was not in the modules directory. Not a big deal. but now when i try to go to http://cacti.domain.com/cacti, Firefox asks if i want to download or open with another program.

I am not getting the login page. error_log and access_log don;t show any problems and php -v also does not show any problems.

So I am making progress (I think).

Any other suggestions? I'm still poking around myself.

Thanks for the help.
PS
Back to top
frankg



Joined: 17 Jan 2008
Posts: 2
Location: TX, USA

PostPosted: Mon Aug 11, 2008 9:22 am    Post subject: Reply with quote

I'm running cacti 0.8.7b on OpenBSD 4.3.

Quote:
in the install docs it says to add the following to the httpd.conf:

"# Load config files from the config directory "/etc/httpd/conf.d".
Include conf.d/*.conf"

I cannot find this line anywhere in the file. Am I missing something?


If you used the official packages to install php, you just need to make a symlink to activate php. The post install message has details:

Code:

$ pkg_info -M php5-core
Information for inst:php5-core-5.2.5p2

Install notice:
To enable the php5 module please create a symbolic
link from /var/www/conf/modules.sample/php5.conf
to /var/www/conf/modules/php5.conf.

ln -s /var/www/conf/modules.sample/php5.conf \
        /var/www/conf/modules

The recommended php configuration has been installed
to /var/www/conf/php.ini.
 
Don't forget that the default OpenBSD httpd is chrooted
into /var/www by default, so you may need to create support
directories such as /var/www/tmp for PHP to work correctly.


Quote:
And when I changed the php5.conf file to include this info:


Those edits belong in /var/www/conf/httpd.conf.
Also, I found that I needed to unchroot Apache to get cacti to work properly.
That's set in /etc/rc.conf.local:

Code:
httpd_flags="-u"


Hope that helps,
Frank
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Mon Aug 11, 2008 9:55 am    Post subject: Reply with quote

frankg, thanks for your help! Seems to not be many people running this on OBSD.

Yes i installed everything from official packages.

I did put in the symlinks as instructed when I was installing PHP.

I do have a few other questions:

1. i should leave the default php5.conf file as it is default?

2. do I change my httpd.conf file back? I found this line and changed it thinking it was the one I wanted:
# Include extra module configuration files
#
Include /var/www/conf/modules/*.conf

3. I was dumb and did not make a backup of the httpd.conf file, so i don;t remember what the above should be. Is there a default? Should i just try re-installing Apache?

4. Where in the httpd.conf file to i put in the lines about PHP? Do they need to be in any particular section?

5. Have you ever found good Cacti on OBSD install instructions anywhere? If so, where?

Thanks again for all you help!
PS
Back to top
paul_psmith



Joined: 05 Aug 2008
Posts: 12
Location: USA

PostPosted: Mon Aug 11, 2008 2:41 pm    Post subject: Reply with quote

Ok. Things have changed. I now get the main page (add device, graph device).No graphics just text and a couple of links.

Also, there is no logon. I just get the main page. How do i get the logon page back.

Also, when I click on the "Create devices" link on the main page, it just gives me web code.



Here is what I've done/found/changed.


Saw this line in the manual, which I had uncommented as part of troubleshooting, but had not commented out again. So I commented it out:

"If using PHP 4.3.5 or less include the following line. If using 4.3.6 or greater, you should remove this line if present.

session.save_path=/tmp"



When I was prompted to save file from http://servername/cacti, it showed this kind of file so i commented this out from the httpd.conf:

"# AddType application/x-httpd-php .php"



These settings are in the php5.conf file:

"LoadModule php5_module /usr/local/lib/php/libphp5.so

<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
AddType text/html .php
AddHandler php5-script .php
# Most php configs require this
DirectoryIndex index.php
</IfModule>"


So maybe put the php5.conf file back to default and put thi in the httpd.conf?

thx PS
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group