Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    10

    Question Unanswered: Help: Can't connect to MySQL server on 'localhost' (10061)

    When I access MySql Database through PHP, I got the following warning and everything stopped working. I am not sure what causes this to happen. If anyone can point me a direction or offer some help, appreciate it very much. Pls refer to PHPINFO. Thanks a lot.

    Warning: Can't connect to MySQL server on 'localhost' (10061) in c:\inetpub\wwwroot\kbase\admin\db_mysql.php on line 42

    Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (10061) in c:\inetpub\wwwroot\kbase\admin\db_mysql.php on line 42

    The PHPINFO:
    PHP Version 4.2.1

    System Windows NT 5.0 build 2195
    Build Date May 12 2002 23:51:56
    Server API ISAPI
    Virtual Directory Support enabled
    Configuration File (php.ini) Path C:\WINNT\php.ini
    Debug Build no
    Thread Safety enabled

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies



    --------------------------------------------------------------------------------

    PHP 4 Credits

    --------------------------------------------------------------------------------

    Configuration
    PHP Core
    Directive Local Value Master Value
    allow_call_time_pass_reference
    On On
    allow_url_fopen
    1 1
    always_populate_raw_post_data
    0 0
    arg_separator.input
    & &
    arg_separator.output
    & &
    asp_tags
    Off Off
    auto_append_file
    no value no value
    auto_prepend_file
    no value no value
    browscap
    no value no value
    default_charset
    no value no value
    default_mimetype
    text/html text/html
    define_syslog_variables
    Off Off
    disable_functions
    no value no value
    display_errors
    On On
    display_startup_errors
    Off Off
    doc_root
    no value no value
    enable_dl
    On On
    error_append_string
    no value no value
    error_log
    no value no value
    error_prepend_string
    no value no value
    error_reporting
    2039 2039
    expose_php
    On On
    extension_dir
    c:\winnt\system32\inetsrv\php\extensions c:\winnt\system32\inetsrv\php\extensions
    file_uploads
    1 1
    gpc_order
    GPC GPC
    highlight.bg
    #FFFFFF #FFFFFF
    highlight.comment
    #FF9900 #FF9900
    highlight.default
    #0000CC #0000CC
    highlight.html
    #000000 #000000
    highlight.keyword
    #006600 #006600
    highlight.string
    #CC0000 #CC0000
    html_errors
    On On
    ignore_user_abort
    Off Off
    implicit_flush
    Off Off
    include_path
    .;c:\php4\pear .;c:\php4\pear
    log_errors
    Off Off
    magic_quotes_gpc
    On On
    magic_quotes_runtime
    Off Off
    magic_quotes_sybase
    Off Off
    max_execution_time
    30 30
    open_basedir
    no value no value
    output_buffering
    no value no value
    output_handler
    no value no value
    post_max_size
    8M 8M
    precision
    12 12
    register_argc_argv
    On On
    register_globals
    On On
    safe_mode
    Off Off
    safe_mode_exec_dir
    no value no value
    safe_mode_gid
    Off Off
    safe_mode_include_dir
    no value no value
    sendmail_from
    webmaster@localhost webmaster@localhost
    sendmail_path
    no value no value
    short_open_tag
    On On
    SMTP
    localhost localhost
    sql.safe_mode
    Off Off
    track_errors
    Off Off
    unserialize_callback_func
    no value no value
    upload_max_filesize
    2M 2M
    upload_tmp_dir
    no value no value
    user_dir
    no value no value
    variables_order
    EGPCS EGPCS
    xmlrpc_error_number
    0 0
    xmlrpc_errors
    Off Off
    y2k_compliance
    Off Off


    standard
    Regex Library Bundled library enabled
    Dynamic Library Support enabled
    Internal Sendmail Support for Windows enabled

    Directive Local Value Master Value
    assert.active
    1 1
    assert.bail
    0 0
    assert.callback
    no value no value
    assert.quiet_eval
    0 0
    assert.warning
    1 1
    safe_mode_allowed_env_vars
    PHP_ PHP_
    safe_mode_protected_env_vars
    LD_LIBRARY_PATH LD_LIBRARY_PATH
    url_rewriter.tags
    a=href,area=href,frame=src,input=src,form=fakeentr y a=href,area=href,frame=src,input=src,form=fakeentr y


    bcmath
    BCMath support enabled


    calendar
    Calendar support enabled


    com
    Directive Local Value Master Value
    com.allow_dcom
    Off Off
    com.autoregister_casesensitive
    On On
    com.autoregister_typelib
    Off Off
    com.autoregister_verbose
    Off Off
    com.typelib_file
    no value no value


    ftp
    FTP support enabled


    mysql
    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 3.23.39

    Directive Local Value Master Value
    mysql.allow_persistent
    On On
    mysql.default_host
    localhost localhost
    mysql.default_password
    adminpass adminpass
    mysql.default_port
    3306 3306
    mysql.default_socket
    no value no value
    mysql.default_user
    kbase kbase
    mysql.max_links
    Unlimited Unlimited
    mysql.max_persistent
    Unlimited Unlimited


    odbc
    ODBC Support enabled
    Active Persistent Links 0
    Active Links 0
    ODBC library Win32

    Directive Local Value Master Value
    odbc.allow_persistent
    On On
    odbc.check_persistent
    On On
    odbc.default_db
    no value no value
    odbc.default_pw
    no value no value
    odbc.default_user
    no value no value
    odbc.defaultbinmode
    return as is return as is
    odbc.defaultlrl
    return up to 4096 bytes return up to 4096 bytes
    odbc.max_links
    Unlimited Unlimited
    odbc.max_persistent
    Unlimited Unlimited


    pcre
    PCRE (Perl Compatible Regular Expressions) Support enabled
    PCRE Library Version 3.4 22-Aug-2000


    session
    Session Support enabled

    Directive Local Value Master Value
    session.auto_start
    Off Off
    session.cache_expire
    180 180
    session.cache_limiter
    nocache nocache
    session.cookie_domain
    no value no value
    session.cookie_lifetime
    0 0
    session.cookie_path
    / /
    session.cookie_secure
    Off Off
    session.entropy_file
    no value no value
    session.entropy_length
    0 0
    session.gc_maxlifetime
    1440 1440
    session.gc_probability
    1 1
    session.name
    PHPSESSID PHPSESSID
    session.referer_check
    no value no value
    session.save_handler
    files files
    session.save_path
    /tmp /tmp
    session.serialize_handler
    php php
    session.use_cookies
    On On
    session.use_trans_sid
    1 1


    xml
    XML Support active
    XML Namespace Support active
    EXPAT Version 1.95.2


    wddx
    WDDX Support enabled


    gd
    GD Support enabled
    GD Version 1.6.2 or higher
    FreeType Support enabled
    FreeType Linkage with TTF library
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled


    ldap
    LDAP Support enabled
    RCS Version $Id: ldap.c,v 1.116.2.1 2002/04/23 18:59:57 derick Exp $
    Total Links 0/unlimited
    API Version 2004
    Vendor Name OpenLDAP
    Vendor Version 20023


    ISAPI
    Server Variable Value
    CONTENT_LENGTH 0
    PATH_TRANSLATED c:\inetpub\wwwroot\kbase\phpinfo.php
    REMOTE_ADDR 127.0.0.1
    REMOTE_HOST 127.0.0.1
    REQUEST_METHOD GET
    SERVER_NAME localhost
    SERVER_PORT 80
    SERVER_PROTOCOL HTTP/1.1
    SERVER_SOFTWARE Microsoft-IIS/5.0
    APPL_MD_PATH /LM/W3SVC/1/Root
    APPL_PHYSICAL_PATH c:\inetpub\wwwroot\
    INSTANCE_ID 1
    INSTANCE_META_PATH /LM/W3SVC/1
    URL /kbase/phpinfo.php
    ALL_HTTP HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    HTTP_ACCEPT_LANGUAGE:en-us,zh-cn;q=0.8,zh-tw;q=0.5,zh-hk;q=0.3
    HTTP_CONNECTION:Keep-Alive
    HTTP_HOST:localhost
    HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
    HTTP_COOKIE:bblastvisit=1022523025; bbuserid=1; bbpassword=25e4ee4e9229397b6b17776bfceaf8e7; bbstyleid=1
    HTTP_ACCEPT_ENCODING:gzip, deflate

    HTTPS off
    SCRIPT_NAME /kbase/phpinfo.php
    SERVER_PORT_SECURE 0


    Additional Modules


    Environment
    Variable Value
    ALLUSERSPROFILE C:\Documents and Settings\All Users
    ANT_HOME C:\ant141
    CATALINA_HOME C:\tomcat403
    CLASSPATH C:\jdk131se;C:\jdk131ee;C:\jdk140se;C:\ant141;C:\M SSQL2K\MSSQL\JDBC\lib\msbase.jar;C:\MSSQL2K\MSSQL\ JDBC\lib\msutil.jar;C:\MSSQL2K\MSSQL\JDBC\lib\mssq lserver.jar;C:\jdom\build\jdom.jar;C:\jdom\lib
    CommonProgramFiles C:\Program Files\Common Files
    COMPUTERNAME WISHMASTER
    ComSpec C:\WINNT\system32\cmd.exe
    INCLUDE C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\include\
    J2EE_HOME C:\jdk131ee
    JAVA_HOME C:\jdk131se
    LIB C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Lib\
    NetSamplePath C:\PROGRA~1\MICROS~1.NET\FRAMEW~1\Samples
    NUMBER_OF_PROCESSORS 1
    OS Windows_NT
    Os2LibPath C:\WINNT\system32\os2\dll;
    Path C:\jdk131se\bin;C:\jdk131ee\bin;C:\jdk140se\bin;C: \ant141\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\Sy stem32\Wbem;C:\Notes;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\WINNT\System32\wbem\;C:\Bi zTalk2002\;C:\Program Files\Common Files\Microsoft Shared\Enterprise Servers\Commerce\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\JBuilder6\jdk1.3.1;C:\JBu ilder6\jdk1.3.1\bin;C:\WINNT\Microsoft.NET\Framewo rk\v1.0.3705;C:\ant141\bin\
    PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE x86
    PROCESSOR_IDENTIFIER x86 Family 6 Model 8 Stepping 10, GenuineIntel
    PROCESSOR_LEVEL 6
    PROCESSOR_REVISION 080a
    ProgramFiles C:\Program Files
    SystemDrive C:
    SystemRoot C:\WINNT
    TEMP C:\WINNT\TEMP
    TMP C:\WINNT\TEMP
    USERPROFILE C:\Documents and Settings\jshen011
    VSCOMNTOOLS "C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\"
    windir C:\WINNT


    PHP Variables
    Variable Value
    PHP_SELF /kbase/phpinfo.php
    _COOKIE["bblastvisit"] 1022523025
    _COOKIE["bbuserid"] 1
    _COOKIE["bbpassword"] 25e4ee4e9229397b6b17776bfceaf8e7
    _COOKIE["bbstyleid"] 1
    _SERVER["ALL_HTTP"] HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    HTTP_ACCEPT_LANGUAGE:en-us,zh-cn;q=0.8,zh-tw;q=0.5,zh-hk;q=0.3
    HTTP_CONNECTION:Keep-Alive
    HTTP_HOST:localhost
    HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
    HTTP_COOKIE:bblastvisit=1022523025; bbuserid=1; bbpassword=25e4ee4e9229397b6b17776bfceaf8e7; bbstyleid=1
    HTTP_ACCEPT_ENCODING:gzip, deflate

  2. #2
    Join Date
    May 2002
    Posts
    16
    the php_info() file is not needed at all. too much traffic for little information.

    please paste the code of the db_mysql.php in here.
    just the connection information and the mysql_connect(). maybe there's a mistake.

    another help could be, if you run a command box and type 'mysql -u root -p' and the root password. maybe you set up the mysql db not correctly.

    so long

  3. #3
    Join Date
    May 2002
    Posts
    10
    ---------------------------------------------------------------------------

    db_mysql.php

    <?php
    error_reporting(7);
    // db class for mysql
    // this class is used in all scripts
    // do NOT fiddle unless you know what you are doing
    unset($showqueries);
    unset($explain);

    class DB_Sql_vb {
    var $database = "kbase";

    var $link_id = 0;
    var $query_id = 0;
    var $record = array();

    var $errdesc = "";
    var $errno = 0;
    var $reporterror = 1;

    var $server = "127.0.0.1";
    var $user = "kbase";
    var $password = "adminpass";

    var $appname = "vBulletin";
    var $appshortname = "vBulletin (cp)";

    function connect() {
    global $usepconnect;
    // connect to db server

    if ( 0 == $this->link_id ) {
    if ($this->password=="") {
    if ($usepconnect==1) {
    $this->link_id=mysql_pconnect($this->server,$this->user);
    } else {
    $this->link_id=mysql_connect($this->server,$this->user);
    }
    } else {
    if ($usepconnect==1) {
    $this->link_id=mysql_pconnect($this->server,$this->user,$this->password);
    } else {
    $this->link_id=mysql_connect($this->server,$this->user,$this->password);
    }
    }
    if (!$this->link_id) {
    $this->halt("Link-ID == false, connect failed");
    }
    if ($this->database!="") {
    if(!mysql_select_db($this->database, $this->link_id)) {
    $this->halt("cannot use database ".$this->database);
    }
    }
    }
    }

    function geterrdesc() {
    $this->error=mysql_error();
    return $this->error;
    }

    function geterrno() {
    $this->errno=mysql_errno();
    return $this->errno;
    }

    function select_db($database="") {
    // select database
    if ($database!="") {
    $this->database=$database;
    }

    if(!mysql_select_db($this->database, $this->link_id)) {
    $this->halt("cannot use database ".$this->database);
    }

    }

    function query($query_string) {
    global $query_count;
    // do query

    $this->query_id = mysql_query($query_string,$this->link_id);
    if (!$this->query_id) {
    $this->halt("Invalid SQL: ".$query_string);
    }

    $query_count++;

    return $this->query_id;
    }

    function fetch_array($query_id=-1,$query_string="") {
    // retrieve row
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    if ( isset($this->query_id) ) {
    $this->record = mysql_fetch_array($this->query_id);
    } else {
    if ( !empty($query_string) ) {
    $this->halt("Invalid query id (".$this->query_id.") on this query: $query_string");
    } else {
    $this->halt("Invalid query id ".$this->query_id." specified");
    }
    }

    return $this->record;
    }

    function free_result($query_id=-1) {
    // retrieve row
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    return @mysql_free_result($this->query_id);
    }

    function query_first($query_string) {
    // does a query and returns first row
    $query_id = $this->query($query_string);
    $returnarray=$this->fetch_array($query_id, $query_string);
    $this->free_result($query_id);
    return $returnarray;
    }

    function data_seek($pos,$query_id=-1) {
    // goes to row $pos
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    return mysql_data_seek($this->query_id, $pos);
    }

    function num_rows($query_id=-1) {
    // returns number of rows in query
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    return mysql_num_rows($this->query_id);
    }

    function num_fields($query_id=-1) {
    // returns number of fields in query
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    return mysql_num_fields($this->query_id);
    }

    function insert_id() {
    // returns last auto_increment field number assigned

    return mysql_insert_id($this->link_id);

    }

    function close() {
    // closes connection to the database

    return mysql_close();
    }

    function halt($msg) {
    $this->errdesc=mysql_error();
    $this->errno=mysql_errno();
    // prints warning message when there is an error
    global $technicalemail, $bbuserinfo, $scriptpath;

    if ($this->reporterror==1) {
    $message="Database error in " . $this->appname . " $GLOBALS[templateversion]:\n\n$msg\n";
    $message.="mysql error: " . $this->errdesc . "\n\n";
    $message.="mysql error number: " . $this->errno . "\n\n";
    $message.="Date: ".date("l dS of F Y h:i:s A")."\n";
    $message.="Script: $GLOBALS[bburl]" . (($scriptpath) ? $scriptpath : getenv("REQUEST_URI")) . "\n";
    $message.="Referer: ".getenv("HTTP_REFERER")."\n";

    if ($technicalemail) {
    @mail ($technicalemail,$this->appshortname. " Database error!",$message,"From: $technicalemail");
    }

    echo "<html><head><title>$GLOBALS[bbtitle] Database Error</title><style>P,BODY{FONT-FAMILY:tahoma,arial,sans-serif;FONT-SIZE:11px;}</style><body>\n\n<!-- $message -->\n\n";

    echo "</table></td></tr></table></form>\n<blockquote><p>&nbsp;</p><p><b>There seems to have been a slight problem with the $GLOBALS[bbtitle] database.</b><br>\n";
    echo "Please try again by pressing the <a href=\"javascript:window.location=window.location; \">refresh</a> button in your browser.</p>";
    echo "An E-Mail has been dispatched to our <a href=\"mailto:$technicalemail\">Technical Staff</a>, who you can also contact if the problem persists.</p>";
    echo "<p>We apologise for any inconvenience.</p>";

    if ($bbuserinfo['usergroupid']==6) {
    echo "<form><textarea rows=\"12\" cols=\"60\">".htmlspecialchars($message)."</textarea></form>";
    }

    echo "</blockquote></body></head></html>";
    exit;
    }
    }
    }
    ?>

    -------------------------------------------------

    Config.php

    <?php
    /////////////////////////////////////////////////////////////
    // Please note that if you get any errors when connecting, //
    // that you will need to email your host as we cannot tell //
    // you what your specific values are supposed to be //
    /////////////////////////////////////////////////////////////

    // type of database running
    // (only mysql is supported at the moment)
    $dbservertype="mysql";

    // hostname or ip of server
    $servername="127.0.0.1";

    // username and password to log onto db server
    $dbusername="kbase";
    $dbpassword="adminpass";

    // name of database
    $dbname="kbase";

    // technical email address - any error messages will be emailed here
    $technicalemail = "jay_shen@msn.com";

    // use persistant connections to the database
    // 0 = don't use
    // 1 = use
    $usepconnect = 0;

    // which users are allowed to view the admin log
    // separate each userid with a comma
    $canviewadminlog = "1";

    // which users are allowed to prune the admin log
    // separate each userid with a comma
    $canpruneadminlog = "";

    ?>

  4. #4
    Join Date
    May 2002
    Posts
    16
    hm, if it i a vBulletin, why you don't call the vBulletin Support? They may help ya out.

    I don't think that there's a mistake in the source code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •