Discussion:
[PHP-INSTALL] Symbolic link needed with mysql and PHP?
Stormont, Stephen (IMS)
2012-10-26 18:03:37 UTC
Permalink
We have a new CentOS installation using PHP5 and MySQL. We were having an issue getting Cacti running, but the problem appears to boil down to a PHP issue.

When attempting to access Cacti via the web, we got this error:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

We checked config.php and everything is configured correctly.

We then looked at "my.cnf" and saw this line:
socket=/var/lib/mysql/mysql.sock

Running "netstat -an | grep mysql" says the following:
unix 2 [ ACC ] STREAM LISTENING 11035 /var/lib/mysql/mysql.sock

However, we have to create a symbolic link in /tmp in order to be able to get to the Cacti config screen:
ln -s /var/lib/mysql/mysql.sock mysql.sock

Why do we have to do this though?

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.
Jonathan Sundquist
2012-10-26 18:10:44 UTC
Permalink
A quick google search turned up a few answers that might help you,

http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail

On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <
Post by Stormont, Stephen (IMS)
We have a new CentOS installation using PHP5 and MySQL. We were having an
issue getting Cacti running, but the problem appears to boil down to a PHP
issue.
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you
have specified a valid MySQL database name in 'include/config.php'
We checked config.php and everything is configured correctly.
socket=/var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 11035
/var/lib/mysql/mysql.sock
However, we have to create a symbolic link in /tmp in order to be able to
ln -s /var/lib/mysql/mysql.sock mysql.sock
Why do we have to do this though?
________________________________
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
Stormont, Stephen (IMS)
2012-10-26 18:12:51 UTC
Permalink
I followed those steps which is what led us to the creation of the symbolic link, but I was attempting to find out why we would even need to do that. Was there some option that we missed at build time for PHP that would have bypassed this issue?

From: Jonathan Sundquist [mailto:***@gmail.com]
Sent: Friday, October 26, 2012 2:11 PM
To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

A quick google search turned up a few answers that might help you,

http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
We have a new CentOS installation using PHP5 and MySQL. We were having an issue getting Cacti running, but the problem appears to boil down to a PHP issue.

When attempting to access Cacti via the web, we got this error:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

We checked config.php and everything is configured correctly.

We then looked at "my.cnf" and saw this line:
socket=/var/lib/mysql/mysql.sock

Running "netstat -an | grep mysql" says the following:
unix 2 [ ACC ] STREAM LISTENING 11035 /var/lib/mysql/mysql.sock

However, we have to create a symbolic link in /tmp in order to be able to get to the Cacti config screen:
ln -s /var/lib/mysql/mysql.sock mysql.sock

Why do we have to do this though?

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.
Jonathan Sundquist
2012-10-26 18:17:34 UTC
Permalink
When you look at your database configuration where does it say the socket
is located?

On Fri, Oct 26, 2012 at 1:12 PM, Stormont, Stephen (IMS) <
Post by Stormont, Stephen (IMS)
I followed those steps which is what led us to the
creation of the symbolic link, but I was attempting to find out why we
would even need to do that. Was there some option that we missed at build
time for PHP that would have bypassed this issue?
*Sent:* Friday, October 26, 2012 2:11 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
A quick google search turned up a few answers that might help you,
http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <
We have a new CentOS installation using PHP5 and MySQL. We were having an
issue getting Cacti running, but the problem appears to boil down to a PHP
issue.
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you
have specified a valid MySQL database name in 'include/config.php'
We checked config.php and everything is configured correctly.
socket=/var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 11035
/var/lib/mysql/mysql.sock
However, we have to create a symbolic link in /tmp in order to be able to
ln -s /var/lib/mysql/mysql.sock mysql.sock
Why do we have to do this though?
________________________________
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
Stormont, Stephen (IMS)
2012-10-26 18:19:57 UTC
Permalink
mysql> status
--------------
mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1

Connection id: 16
Current database:
Current user: ***@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.61 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 50 min 29 sec


From: Jonathan Sundquist [mailto:***@gmail.com]
Sent: Friday, October 26, 2012 2:18 PM
To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

When you look at your database configuration where does it say the socket is located?
On Fri, Oct 26, 2012 at 1:12 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
I followed those steps which is what led us to the creation of the symbolic link, but I was attempting to find out why we would even need to do that. Was there some option that we missed at build time for PHP that would have bypassed this issue?

From: Jonathan Sundquist [mailto:***@gmail.com<mailto:***@gmail.com>]
Sent: Friday, October 26, 2012 2:11 PM
To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net<mailto:php-***@lists.php.net>
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

A quick google search turned up a few answers that might help you,

http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
We have a new CentOS installation using PHP5 and MySQL. We were having an issue getting Cacti running, but the problem appears to boil down to a PHP issue.

When attempting to access Cacti via the web, we got this error:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

We checked config.php and everything is configured correctly.

We then looked at "my.cnf" and saw this line:
socket=/var/lib/mysql/mysql.sock

Running "netstat -an | grep mysql" says the following:
unix 2 [ ACC ] STREAM LISTENING 11035 /var/lib/mysql/mysql.sock

However, we have to create a symbolic link in /tmp in order to be able to get to the Cacti config screen:
ln -s /var/lib/mysql/mysql.sock mysql.sock

Why do we have to do this though?

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.
Jonathan Sundquist
2012-10-26 18:24:40 UTC
Permalink
Sorry I meant to say your database config within the Cacti application.
From the link that I sent previously it makes me think its looking for the
socket to be in /tmp

On Fri, Oct 26, 2012 at 1:19 PM, Stormont, Stephen (IMS) <
Post by Stormont, Stephen (IMS)
mysql> status
--------------
mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1
Connection id: 16
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.61 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 50 min 29 sec
*Sent:* Friday, October 26, 2012 2:18 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
When you look at your database configuration where does it say the socket is located?
On Fri, Oct 26, 2012 at 1:12 PM, Stormont, Stephen (IMS) <
I followed those steps which is what led us to the
creation of the symbolic link, but I was attempting to find out why we
would even need to do that. Was there some option that we missed at build
time for PHP that would have bypassed this issue?
*Sent:* Friday, October 26, 2012 2:11 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
A quick google search turned up a few answers that might help you,
http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <
We have a new CentOS installation using PHP5 and MySQL. We were having an
issue getting Cacti running, but the problem appears to boil down to a PHP
issue.
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you
have specified a valid MySQL database name in 'include/config.php'
We checked config.php and everything is configured correctly.
socket=/var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 11035
/var/lib/mysql/mysql.sock
However, we have to create a symbolic link in /tmp in order to be able to
ln -s /var/lib/mysql/mysql.sock mysql.sock
Why do we have to do this though?
________________________________
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
Stormont, Stephen (IMS)
2012-10-26 18:32:57 UTC
Permalink
That's what it seems like to me too, but the socket path in the database for Cacti is "/var/lib/mysql/mysql.sock". I don't see an option in any of the Cacti config files that would allow me to point it elsewhere other than what is noted in that database and the Cacti folk claim it isn't their issue but a PHP one.

From: Jonathan Sundquist [mailto:***@gmail.com]
Sent: Friday, October 26, 2012 2:25 PM
To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

Sorry I meant to say your database config within the Cacti application. From the link that I sent previously it makes me think its looking for the socket to be in /tmp
On Fri, Oct 26, 2012 at 1:19 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
mysql> status
--------------
mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1

Connection id: 16
Current database:
Current user: ***@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.61 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 50 min 29 sec


From: Jonathan Sundquist [mailto:***@gmail.com<mailto:***@gmail.com>]
Sent: Friday, October 26, 2012 2:18 PM

To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net<mailto:php-***@lists.php.net>
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

When you look at your database configuration where does it say the socket is located?
On Fri, Oct 26, 2012 at 1:12 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
I followed those steps which is what led us to the creation of the symbolic link, but I was attempting to find out why we would even need to do that. Was there some option that we missed at build time for PHP that would have bypassed this issue?

From: Jonathan Sundquist [mailto:***@gmail.com<mailto:***@gmail.com>]
Sent: Friday, October 26, 2012 2:11 PM
To: Stormont, Stephen (IMS)
Cc: php-***@lists.php.net<mailto:php-***@lists.php.net>
Subject: Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?

A quick google search turned up a few answers that might help you,

http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <***@imsweb.com<mailto:***@imsweb.com>> wrote:
We have a new CentOS installation using PHP5 and MySQL. We were having an issue getting Cacti running, but the problem appears to boil down to a PHP issue.

When attempting to access Cacti via the web, we got this error:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

We checked config.php and everything is configured correctly.

We then looked at "my.cnf" and saw this line:
socket=/var/lib/mysql/mysql.sock

Running "netstat -an | grep mysql" says the following:
unix 2 [ ACC ] STREAM LISTENING 11035 /var/lib/mysql/mysql.sock

However, we have to create a symbolic link in /tmp in order to be able to get to the Cacti config screen:
ln -s /var/lib/mysql/mysql.sock mysql.sock

Why do we have to do this though?

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.


________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.
Jonathan Sundquist
2012-10-26 18:36:45 UTC
Permalink
Two things.

1. Run create a file containing phpinfo(); and see where it says the mysql
socket path is. This will tell you were php expects it to be.
2. Every time I reply to your emails I get an annoying abuse department
email, can you turn that off if you will be having people reply to you.

On Fri, Oct 26, 2012 at 1:32 PM, Stormont, Stephen (IMS) <
That’s what it seems like to me too, but the socket path
in the database for Cacti is “/var/lib/mysql/mysql.sock”. I don’t see an
option in any of the Cacti config files that would allow me to point it
elsewhere other than what is noted in that database and the Cacti folk
claim it isn’t their issue but a PHP one.
*Sent:* Friday, October 26, 2012 2:25 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
Sorry I meant to say your database config within the Cacti application.
From the link that I sent previously it makes me think its looking for the
socket to be in /tmp
On Fri, Oct 26, 2012 at 1:19 PM, Stormont, Stephen (IMS) <
mysql> status
--------------
mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1
Connection id: 16
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.61 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 50 min 29 sec
*Sent:* Friday, October 26, 2012 2:18 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
When you look at your database configuration where does it say the socket is located?
On Fri, Oct 26, 2012 at 1:12 PM, Stormont, Stephen (IMS) <
I followed those steps which is what led us to the
creation of the symbolic link, but I was attempting to find out why we
would even need to do that. Was there some option that we missed at build
time for PHP that would have bypassed this issue?
*Sent:* Friday, October 26, 2012 2:11 PM
*To:* Stormont, Stephen (IMS)
*Subject:* Re: [PHP-INSTALL] Symbolic link needed with mysql and PHP?
A quick google search turned up a few answers that might help you,
http://docs.cacti.net/manual:087:4_help.1_faq#database_setup_seems_to_fail
On Fri, Oct 26, 2012 at 1:03 PM, Stormont, Stephen (IMS) <
We have a new CentOS installation using PHP5 and MySQL. We were having an
issue getting Cacti running, but the problem appears to boil down to a PHP
issue.
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you
have specified a valid MySQL database name in 'include/config.php'
We checked config.php and everything is configured correctly.
socket=/var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 11035
/var/lib/mysql/mysql.sock
However, we have to create a symbolic link in /tmp in order to be able to
ln -s /var/lib/mysql/mysql.sock mysql.sock
Why do we have to do this though?
________________________________
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
------------------------------
Information in this e-mail may be confidential. It is intended only for
the addressee(s) identified above. If you are not the addressee(s), or an
employee or agent of the addressee(s), please note that any dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this e-mail in error, please notify the sender of the
error.
Keith Roberts
2012-10-26 19:40:23 UTC
Permalink
On Centos 5.8, I have changed the default path to the MySQL
socket file using this setting in php.ini:

; Default socket name for local MySQL connects.
; If empty, uses the built-in ; MySQL defaults.
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-socket
mysql.default_socket = /var/lib/databases/mysql/mysql.sock

If you are running PHP as an apache module, don't forget to
stop and start apache to make it re-read any changes you
make to the php.ini file.

HTH

Keith

-----------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------

Continue reading on narkive:
Loading...