مرحبًا ، لقد قمت بتثبيت phpmyadmin على جهاز centos الخاص بي ، وعندما أحاول الوصول إلى phpmyadmin
من خلال متصفحي ، يظهر لي هذا الخطأ:
Forbidden
You don't have permission to access `phpmyadmin` on this server.
يحتوي ملف phpmyadmin.conf
الخاص بي على المحتوى التالي:
# 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>
يرجى مساعدتي في حل هذه المشكلة. ويقدر أي الرصاص.
شكر
تحتاج إلى اتباع الخطوات التالية:
العثور على السطر الذي يلي قراءة
Require ip 127.0.0.1
استبدل عنوان IP الخاص بمحطة العمل:
Require ip 10.1.3.53
مرة أخرى ، ابحث عن السطر التالي:
Allow from 127.0.0.1
يستعاض عن ما يلي:
Allow from 10.1.3.53
ابحث أيضًا عن deny from all
وقم بالتعليق عليه في الملف بأكمله.
احفظ وأغلق الملف .Restart Apache httpd server
:
# service httpd restart
لم يعمل أيٍ من التكوين أعلاه على خادم CentOS 7 الخاص بي. بعد ساعات من البحث ، هذا ما نجح لي:
تحرير ملف phpMyAdmin.conf
Sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
واستبدل هذا في الأعلى:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</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>
على تثبيت جديد على CENTOS7 ، جربت الأساليب المذكورة أعلاه (تحرير phpMyAdmin.conf وإضافة طلب منح جميع) ، لا يزال لا يعمل. إليك الحل: تثبيت الوحدة النمطية mod_php:
$ Sudo yum install php
ثم أعد تشغيل httpd:
$ Sudo systemctl restart httpd
وفويلا!
تحرير الملف: Sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
واستبداله بما يلي:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
</IfModule>
</Directory>
أعد تشغيل Apache: service httpd restart
(phpMyAdmin v4.0.10.8)
المشكلة في الإجابة بأكثر الأصوات هي أنها لا تفسر سبب الحل.
بالنسبة للخطوط Require ip 127.0.0.1
، يجب عليك بدلاً من ذلك إضافة عنوان IP الخاص بالمضيف الذي يخطط للوصول إلى phpMyAdmin من المستعرض. على سبيل المثال Require ip 192.168.0.100
. Require ip 127.0.0.1
يسمح بوصول المضيف المحلي إلى phpMyAdmin.
أعد تشغيل Apache (httpd) بعد إجراء التغييرات. أقترح إجراء اختبار على المضيف المحلي ، أو استخدام أدوات سطر الأوامر مثل curl حتى يعمل http GET ، ولا توجد مشكلة في التكوين.
للسماح من الجميع:
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
أولاً قم بتحرير الملف /etc/httpd/conf.d/phpMyAdmin.conf وأضف السطر الإضافي إلى إعدادات الدليل:
<Directory /usr/share/phpMyAdmin/>
order deny,allow
deny from all
allow from 127.0.0.1
allow from 192.168.1.0/15
</Directory>
إذا كنت تريد السماح بالوصول إلى الجميع ، فيمكنك تغييره إلى:
<Directory /usr/share/phpMyAdmin/>
order allow,deny
allow from all
</Directory>
السماح في جميع أقسام الملف.
إعادة التشغيل (إعادة تشغيل httpd service) كافية لالتقاط هذا الأمر.
لقد وجدت هذا بعد يومين من البحث الدقيق ، (ابحث عنه هنا ) وعملت بشكل مناسب لي.
يمكنك ببساطة الانتقال إلى ملف phpmyadmin.conf وتغيير "رفض من الكل" إلى "السماح من الجميع". حسنًا ، لقد نجح هذا الأمر بالنسبة لي ، آمل أن يكون مفيدًا لك.