PHP not working

  • TonyM

    TonyM - 2006-03-13

    Can anyone help with this?

    [client] PHP Warning:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/nagiosweb/dbconfig.php on line 5, referer:

    • Josh Konkol

      Josh Konkol - 2006-03-17

      Have you put in your un/pw in dbconfig.php ?  Looks to me like you are having permissions problem.


      • TonyM

        TonyM - 2006-03-21

        Did I miss something in the documentation?  I am not quite sure where to put the un/pw.  I am wondering as well if I am using the redhat distribution of apache if that is throwing something off.


    • Josh Konkol

      Josh Konkol - 2006-03-27

      There is a file called dbconfig.php, you need to put your login info in there.

    • Tony Messerschmidt

      Thanks much.  I got this working however now when I click on any of the side buttons I can see the php code in the web browser.  Any help would be great.

    • Josh Konkol

      Josh Konkol - 2006-05-03

      Do you have PHP compiled to work with apache?  A very simple php page you can create for testing is:

      <? phpinfo() ?>

      Good Luck


    • Tony Messerschmidt


      echo phpinfo();

      I was able to determine that php is working fine.  what I think may be going on is it isn't pulling info from mysql.  I have edited the dbconfig.php file for the username and password and can log into mysql

      mysql -u someuser -p nagiosweb

      and view the tables just fine, but what I see on the web page is this..

      ', $myhost["host_id"], $myhost["host_name"], $myhost["alias"], $myhost["address"]); echo "\n"; } ?>

      and in the hosts tables on the page I get the %S and same for the other fields.

    • Josh Konkol

      Josh Konkol - 2006-05-05

      Did you maybe delete the <? in the dbconfig.php file when you edited it?

      I would start with a new dbconfig.php file and edit it again.


    • Tony Messerschmidt

      got it working.  problem with libmysqlclient not installed.

    • emen

      emen - 2006-12-20


      I still see the PHP code when I click on any links from the Configuration.  I verified that I have PHP working with APACHE.  I verified that I didn't ommit the <? or anything from the dbconfig.php.  I started out with a bare dbconfig.php to begin with.  I also created a script that will verify that my SQL server is accessible from a php page.  What should I do?  Can someone help?


Log in to post a comment.