linux-nerds.org

    linux-nerds.org

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    pdo Abfrage funktioniert nicht

    Linux
    linux
    1
    2
    416
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • FrankM
      FrankM last edited by FrankM

      Heute habe ich mal wieder zwei Stunden meines Lebens damit verbracht, zu verstehen warum etwas nicht geht, was für mich eigentlich funktionieren sollte!?!?

      System

      Ein ROCKPro64 mit bionic-minimal

      root@rockpro64v2_0:/var/log/nginx# uname -a
      Linux rockpro64v2_0 4.19.0-rc4-1065-ayufan-g72e04c7b3e06 #1 SMP PREEMPT Sat Sep 29 21:27:52 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
      

      Fangen wir vorne an. Ich habe ein Projekt, was ich mit PHP mal gecodet habe, darin sind alle Datenbankabfragen konsequent auf pdo getrimmt. Nach einer lokalen Installation geht nix 😞

      Beispiel

      <?php
      
      echo "DATENBANK TEST";
      
      $pdo = new PDO('mysql:host=localhost;dbname=database', 'user', 'password');
       
      $statement = $pdo->prepare("SELECT vorname, nachname FROM users");
       
      if($statement->execute()) {
          while($row = $statement->fetch()) {
              echo $row['vorname']."<br />";
          }    
      } else {
          echo "SQL Error <br />";
          echo $statement->queryString."<br />";
          echo $statement->errorInfo()[2];
      }
      ?>
      

      Gut, Datenbankaufruf falsch, Pfade stimmen nicht usw. Erste Stunde weg. Nachdem mir nichts mehr eingefallen ist, angefangen zu zweifeln das pdo unterstützt wird. Also im Netz auf die Suche gemacht. Folgendes gefunden.

      extension=pdo.so
      extension=pdo_mysql.so
      

      Das ans Ende der php.ini gehangen.

      nano /etc/php/7.2/fpm/php.ini
      

      Danach mal eben

      /etc/init.d/php7.2-fpm reload
      service nginx restart
      

      und siehe da, es geht! 🙂 Jetzt habe ich wieder deutlich bessere Laune 😉 Das war dann die zweite Stunde die weg war, aber zum Glück mit einer Lösung.

      1. RockPro64 v2.1 / PCIe SATA 5 Ports / Boot direct from port 5 SSD / 2 * 3,5 Zoll 4TB HDD (raid1) / 2 * 2,5 Zoll 2 TB (raid 1) using as NAS / Kernel Linux NASrp64 5.6.0-1137-ayufan-ge57f05e7bf8f

      2. RockPro64 v2.1 for testing ;)

      3. Quartz64 Model A

      1 Reply Last reply Reply Quote 0
      • FrankM
        FrankM last edited by

        Wichtig ist natürlich auch, das folgendes php Paket installiert ist!

        sudo apt install php7.0-mysql
        

        Je nachdem welche PHP Version installiert ist, muss der Befehl angepasst werden. Mit

        php -v
        

        könnt ihr nachschauen welche Version installiert ist.

        1. RockPro64 v2.1 / PCIe SATA 5 Ports / Boot direct from port 5 SSD / 2 * 3,5 Zoll 4TB HDD (raid1) / 2 * 2,5 Zoll 2 TB (raid 1) using as NAS / Kernel Linux NASrp64 5.6.0-1137-ayufan-ge57f05e7bf8f

        2. RockPro64 v2.1 for testing ;)

        3. Quartz64 Model A

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        • FrankM

          Ansible - ein kurzer Test
          Linux • ansible linux • • FrankM

          1
          0
          Votes
          1
          Posts
          33
          Views

          No one has replied

        • FrankM

          Armbian Images
          Armbian • armbian linux • • FrankM

          1
          0
          Votes
          1
          Posts
          142
          Views

          No one has replied

        • FrankM

          Nach Kernel Update werden die Module nicht automatisch gebaut!?
          Linux • linux • • FrankM

          1
          0
          Votes
          1
          Posts
          92
          Views

          No one has replied

        • FrankM

          IPv6 und Subnetze
          Linux • linux ipv6 • • FrankM

          1
          0
          Votes
          1
          Posts
          113
          Views

          No one has replied

        • FrankM

          Linux Befehle - ls & tail
          Linux • linux • • FrankM

          1
          0
          Votes
          1
          Posts
          194
          Views

          No one has replied

        • FrankM

          Redis startet nicht!?
          Redis • redis • • FrankM

          1
          0
          Votes
          1
          Posts
          234
          Views

          No one has replied

        • FrankM

          Raid1 - Platte verschwunden!?
          Linux • linux • • FrankM

          1
          1
          Votes
          1
          Posts
          313
          Views

          No one has replied

        • FrankM

          NodeBB - nach Plugin platt
          NodeBB • nodebb linux • • FrankM

          1
          0
          Votes
          1
          Posts
          496
          Views

          No one has replied

        Powered by NodeBB | Contributors
        © 2022 frank-mankel.de