Ankündigung

Einklappen
Keine Ankündigung bisher.

[Erledigt] PHP bekommt keine Verbindung zu MySQL

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [Erledigt] PHP bekommt keine Verbindung zu MySQL

    Hallo,
    ich habe einen Windows Server 2008 Standard Edition (Service Pack 2) mit installiertem Apache/2.2.16 (Win32) und PHP/5.3.3
    Als MySQL ist MySQL Server 5.1 installiert.

    Webserver, PHP und MySQL laufen, das Problem besteht aber darin, dass ich keine Verbindung vom Webserver/PHP zum MySQL hinbekomme. Anfragen per PHP führen immer zu einem HTTP 500 Fehler. Per Console ist der Zugriff auf MySQl problemlos möglich.

    phpinfo sagt folgendes zum MySQL:

    mysql
    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $

    Directive Local Value Master Value
    mysql.allow_local_infile On On
    mysql.allow_persistent On On
    mysql.connect_timeout 60 60
    mysql.default_host no value no value
    mysql.default_password no value no value
    mysql.default_port 3306 3306
    mysql.default_socket no value no value
    mysql.default_user no value no value
    mysql.max_links 500 500
    mysql.max_persistent 200 200
    mysql.trace_mode Off Off


    Irgendjemannd eine Idee? ich komme echt nicht mehr weiter

  • #2
    tritt das auch auf, wenn du PDO oder MySQLi benutzt? gibt es irgendwelche Hinweise in den error logs von Apache/PHP?

    Kommentar


    • #3
      php-errors.log sagt:

      [17-Sep-2010 14:32:57] PHP Warning: mysql_connect(): [2002] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle na (trying to connect via tcp://localhost:3306) in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:32:57] PHP Warning: mysql_connect(): Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.

      in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:32:57] PHP Fatal error: Maximum execution time of 30 seconds exceeded in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:36:19] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead in D:\Program Files (x86)\Apache2.2\htdocs\index.php on line 5

      [17-Sep-2010 14:37:29] PHP Warning: mysql_connect(): [2002] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle na (trying to connect via tcp://localhost:3306) in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:37:29] PHP Warning: mysql_connect(): Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.

      in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:37:29] PHP Fatal error: Maximum execution time of 30 seconds exceeded in D:\Program Files (x86)\Apache2.2\htdocs\test.php on line 4

      [17-Sep-2010 14:38:23] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead in D:\Program Files (x86)\Apache2.2\htdocs\index.php on line 5

      [17-Sep-2010 14:40:44] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead in D:\Program Files (x86)\Apache2.2\htdocs\index.php on line 5

      [17-Sep-2010 14:51:42] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead in D:\Program Files (x86)\Apache2.2\htdocs\index.php on line 5
      Wie kann ich denn PDO oder MySQLi "gezielt" ansprechen?

      Kommentar


      • #4
        Hast du erst mal überprüft, ob MySQL überhaupt läuft ...?
        [SIZE="1"]RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?[/SIZE]

        Kommentar


        • #5
          MySQL läuft, ich bekomme beim telnet auf Port 3006 ein Prompt und über die mysql Console kann ich mich auch connecten. Nur per Web/PHP will nichts

          Kommentar


          • #6
            Hat der MySQL-Server ein Log, in dem der Zugriffsversuch protokolliert wird?
            [SIZE="1"]RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?[/SIZE]

            Kommentar


            • #7
              Leider nicht.

              Kommentar


              • #8
                liegt die Mysql auf dem gleichen Rechner ? sonst trag doch mal statt dem "Lokalen Horst" mal die richtige IP ein .. außerdem schreibst du beim telnet von Port 3006 ? php versucht es mit mysql aber standardmäßig auf 3306 .. prüfe das mal bitte nach
                "Irren ist männlich", sprach der Igel und stieg von der Drahtbürste [IMG]http://www.php.de/core/images/smilies/icon_lol.gif[/IMG]

                Kommentar


                • #9
                  @SaKe: Wie baust du die Verbindung von php zu MySQL auf?
                  Programmierung und SEO Blog

                  Kommentar


                  • #10
                    Telnet mach ich schon auf 3306, war ein Vertipper.
                    Also ich bekomme Verbindungen wenn ich auf die IP, nicht 127.0.0.1, connecte. Nur localhost bekommt immer HTTP 500 :-/

                    Kommentar


                    • #11
                      tja, dann würd ich drauf wetten, das in deiner hosts Datei nicht 127.0.0.1 localhost drinsteht ,oder auskommentiert ist ...

                      ist bei Windows manchmal so , manche Netzwerktreiber tragen es dort automatisch ein, manche wiederrum nicht ..
                      "Irren ist männlich", sprach der Igel und stieg von der Drahtbürste [IMG]http://www.php.de/core/images/smilies/icon_lol.gif[/IMG]

                      Kommentar


                      • #12
                        Doch, steht drinn.

                        Kommentar


                        • #13
                          was dann noch nicht heißt, dass php da auch nachguckt - ich meine mich erinnern zu können, dass im manual irgendwas stand, dass localhost manchmal Probs macht - und 127.0.0.1 ist ja nun so offensichtlich , dass trotzdem klar ist, wo die DB liegt ...

                          viel erfolg dann beim weiterbasteln
                          "Irren ist männlich", sprach der Igel und stieg von der Drahtbürste [IMG]http://www.php.de/core/images/smilies/icon_lol.gif[/IMG]

                          Kommentar


                          • #14
                            DANKE!
                            Guter Tip das localhost ja offentsichlich sein soll.

                            Bein Ping auf localhost antwortete ::1 , blödes IPv6!
                            Kurz den Eintrag in der hosts auskommentiert und nun gehts. Was fürn blöder Fehler, aber vielen Dank für die Hilfe!

                            Kommentar


                            • #15
                              hehe an IPv6 hab ich auch kurz gedacht - aber dass dir das so in die Quere kommt .....
                              "Irren ist männlich", sprach der Igel und stieg von der Drahtbürste [IMG]http://www.php.de/core/images/smilies/icon_lol.gif[/IMG]

                              Kommentar

                              Lädt...
                              X