phpMyAdmin erlaubt entfernte Benutzer

Lesezeit: 6 Minuten

Benutzer-Avatar
Germano Massullo

Ich muss die Datei ändern /etc/httpd/conf.d/phpMyAdmin.conf
um entfernten Benutzern (nicht nur localhost) die Anmeldung zu ermöglichen

# phpMyAdmin - Web based MySQL browser written in php
# 
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>

  • Möchten Sie, dass es für alle offen ist oder nur für bestimmte IP-Adressen?

    – Haru

    16. Mai 2014 um 21:23 Uhr

  • Ich möchte es für alle öffnen

    – Germano Massullo

    16. Mai 2014 um 21:25 Uhr

  • Hast du das jemals zum Laufen bekommen?

    – Alexandre Bourlier

    6. November 2014 um 15:44 Uhr

  • @Euloiix nein, weil die virtuelle Maschine, auf der PHPmyAdmin ausgeführt wurde, nicht mehr verfügbar ist

    – Germano Massullo

    6. November 2014 um 19:54 Uhr

Benutzer-Avatar
Chris

Die anderen Antworten scheinen bisher die vollständige Ersetzung des -Blocks zu befürworten, dies wird nicht benötigt und kann zusätzliche Einstellungen wie das jetzt enthaltene „AddDefaultCharset UTF-8“ entfernen.

Aktualisierung 2021

Die Konfigurationsdatei ist jetzt vereinfacht, sodass nur eine einzige Zeile hinzugefügt werden muss:

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   Require local
   # ADD following line:
   Require all granted
</Directory>

Ursprüngliche Antwort

Um den Fernzugriff zu ermöglichen, müssen Sie 1 Zeile zum 2.4-Konfigurationsblock hinzufügen oder 2 Zeilen in 2.2 ändern (abhängig von Ihrer Apache-Version):

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       # ADD following line:
       Require all granted
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     # CHANGE following 2 lines:
     Order Allow,Deny
     Allow from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

  • Ich kann bestätigen, dass dies mit Centos 7 funktioniert. Danke.

    – Syaiful Nizam Yahya

    22. September 2015 um 8:27 Uhr

  • Funktioniert auf EC2-Instances.

    – driftking9987

    3. Mai 2016 um 18:35 Uhr

  • Die anderen Antworten haben bei mir nicht funktioniert, das hat funktioniert. Danke Chris!!

    – Naguib Ihab

    15. September 2016 um 7:55 Uhr

  • ALLE: Probieren Sie dies zuerst aus, es ist das einzige, das auf EC2-Linux-Instanzen funktioniert. Danke Chris!

    – Emmet kommt an

    19. November 2016 um 2:45 Uhr

Verwenden Sie dies, es wurde für mich behoben, über CentOS 7

<Directory /usr/share/phpMyAdmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>

  • Funktioniert auf meinem Amazon Linux

    – Kanak Singhal

    17. März 2016 um 18:08 Uhr

Benutzer-Avatar
nl-x

Ersetzen Sie den Inhalt der ersten <directory> Schild.

Entfernen:

<Directory /usr/share/phpMyAdmin/>
 <IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAny>
    Require ip 127.0.0.1
    Require ip ::1
  </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
  # Apache 2.2
  Order Deny,Allow
  Deny from All
  Allow from 127.0.0.1
  Allow from ::1
 </IfModule>
</Directory>

Und platziere stattdessen Folgendes:

<Directory /usr/share/phpMyAdmin/>
 Order allow,deny
 Allow from all
</Directory>

Vergessen Sie nicht, Apache danach neu zu starten.

  • 16. Mag 23:33:29 localhost.localdomain httpd[2212]: httpd: Syntaxfehler in Zeile 353 von /etc/httpd/conf/httpd.conf: Syntaxfehler in Zeile 11 von /etc/httpd/conf.d/phpMyAdmin.conf: /etc/httpd mag 16 23:33:29 localhost.localdomain systemd[1]: httpd.service: Hauptprozess beendet, Code=beendet, Status=1/FAILURE mag 16 23:33:29 localhost.localdomain systemd[1]: Der Apache HTTP-Server konnte nicht gestartet werden. — Betreff: Unit httpd.service ist fehlgeschlagen — Defined-By: systemd — Unterstützung: listen.freedesktop.org/mailman/listinfo/systemd-devel

    – Germano Massullo

    16. Mai 2014 um 21:34 Uhr

  • Im Browser erhalte ich: Forbidden: You don't have permission to access /phpmyadmin on this server.

    – Germano Massullo

    17. Mai 2014 um 7:40 Uhr

  • Ich füge meinem vorherigen Kommentar eine Anmerkung hinzu, da es nicht möglich ist, ihn zu bearbeiten. Ich bin auch nicht nach Benutzer und Passwort gefragt worden, bevor ich das bekommen habe Forbidden: You don't have permission to access /phpmyadmin on this server. Fehlermeldung

    – Germano Massullo

    18. Mai 2014 um 15:34 Uhr


Benutzer-Avatar
John Guan

Versuche dies

Ersetzen

<Directory /usr/share/phpMyAdmin/>
    <IfModule mod_authz_core.c>
        # Apache 2.4
        <RequireAny>
            Require ip 127.0.0.1
            Require ip ::1
        </RequireAny>
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order Deny,Allow
        Deny from All
        Allow from 127.0.0.1
        Allow from ::1
    </IfModule>
</Directory>

Mit diesem:

<Directory "/usr/share/phpMyAdmin/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Allow,Deny 
    Allow from all
</Directory>

Fügen Sie die folgende Zeile hinzu, um den Zugriff zu erleichtern:

Alias /phpmyadmin /usr/share/phpMyAdmin

Benutzer-Avatar
Thrasher8390

Mein Setup war mit XAMPP etwas anders. in httpd-xampp.conf musste ich folgende Änderung vornehmen.

Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
    AllowOverride AuthConfig
    Require local
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

ändern

Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
    AllowOverride AuthConfig
    #makes it so I can config the database from anywhere
    #change the line below
    Require all granted
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

Ich muss sagen, dass ich ganz neu darin bin, also hacke ich nur herum, aber so habe ich es zum Laufen gebracht.

Benutzer-Avatar
ursuleacv

Kommentieren Sie einfach alle Zeilen im ersten Verzeichnis. Oder Sie können diese Zeilen entfernen, aber besser aufbewahren, falls Sie später einige Einschränkungen hinzufügen möchten, werden Sie sie auskommentieren.

#<Directory /usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     <RequireAny>
#       Require ip 127.0.0.1
#       Require ip ::1
#     </RequireAny>
#   </IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from 127.0.0.1
#     Allow from ::1
#   </IfModule>
#</Directory>

Benutzer-Avatar
sakumatto

Meine Antwort basiert darauf, dass ich einen 403-Fehler bekomme, obwohl ich alle in den anderen Antworten erwähnten Apache-Einstellungen korrekt hatte.

Es war ein frischer Centos 7-Server und es stellte sich heraus, dass das Problem nicht die Apache-Einstellungen waren, sondern die Tatsache, dass PhpMyAdmin überhaupt nicht funktionierte. Die Lösung bestand darin, php zu installieren und die php-Direktive zu apache.conf hinzuzufügen:

  • sudo yum installiere php php-mysql
  • vim /etc/httpd/conf/httpd.conf so etwas hinzufügen wie
  • DirectoryIndex index.php index.phtml index.html index.htm, um auch PHP-Indexdateien bereitzustellen, und starten Sie dann Apache neu

Vergessen Sie nicht, den Apache-Server neu zu starten, damit er wirksam wird – systemctl restart httpd.service

Ich hoffe das hilft. Ich dachte zuerst, mein Problem wären Apache-Direktiven, also poste ich meine Lösung hier.

1205460cookie-checkphpMyAdmin erlaubt entfernte Benutzer

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy