How can I prevent php mysql server error from displaying the User name and password??

Discussion in 'Security' started by Tonb2000, Jan 25, 2010.

  1. #1
    Hello! I have this problem every time there is a error on my site, the php error display all my database user name an password.



    Is there a way to prevent or supress php mysql server error, from displaying my user name and password to visitors in the web browser when it can't connect to MYSQL or there is a php script error??
     
    Tonb2000, Jan 25, 2010 IP
  2. arunns

    arunns Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you tried?

    <?php
    $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    if (!$link) {
    die('Could not connect to mysql');
    }
    echo 'Connected successfully';
    mysql_close($link);
    ?>
     
    arunns, Jan 25, 2010 IP