After installing LAMP on your Linux server, if you are getting error like "Forbidden:You don't have permission to access /phpmyadmin/ on this server", then it means that you are accessing it from server ip address and it is allowed from only localhost or you are accessing it from localhost and it is allowed only from ip address. So what to do next?

Type command -
sudo gedit /etc/httpd/conf.d/phpMyAdmin.conf
You will get the phpMyAdmin.conf file and at top you will find following code
Chane the line Require ip 127.0.0.1 and Allow from 127.0.0.1 if you want to access it using localhost on local machine. If you want to access it using your system ip address on local machine then change 127.0.0.1 to to your system ip address
<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
</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>
If you want to access this server from any machine then replace the above code with
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
#Apache 2.2
Order Allow, Deny
Allow from all
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

Type command -
sudo gedit /etc/httpd/conf.d/phpMyAdmin.conf
You will get the phpMyAdmin.conf file and at top you will find following code
Chane the line Require ip 127.0.0.1 and Allow from 127.0.0.1 if you want to access it using localhost on local machine. If you want to access it using your system ip address on local machine then change 127.0.0.1 to to your system ip address
<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
</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>
If you want to access this server from any machine then replace the above code with
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
#Apache 2.2
Order Allow, Deny
Allow from all
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
No comments:
Post a Comment