Help- install - cannot connect to mySQL
Moderators: Developers, Moderators
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
Help- install - cannot connect to mySQL
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
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
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!
#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!
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
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
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
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.
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.
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)
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)
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
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
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
I'm running cacti 0.8.7b on OpenBSD 4.3.
Also, I found that I needed to unchroot Apache to get cacti to work properly.
That's set in /etc/rc.conf.local:
Hope that helps,
Frank
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: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?
Code: Select all
$ 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.
Those edits belong in /var/www/conf/httpd.conf.And when I changed the php5.conf file to include this info:
Also, I found that I needed to unchroot Apache to get cacti to work properly.
That's set in /etc/rc.conf.local:
Code: Select all
httpd_flags="-u"
Frank
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
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
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
-
- Posts: 12
- Joined: Tue Aug 05, 2008 11:38 am
- Location: USA
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
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
Who is online
Users browsing this forum: No registered users and 1 guest