Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ how to prevent users to access xampp phpmyadmin control panel directly

Posted by: shankar from vizag Nov 5 2023, 06:05 AM

Greetings

Please suggest simpler ways for the following two issues:

1. How to prevent USERS to access directly to the XAMPP phpmyadmin C-panel through browser.

2. Can I define a name instead of IP address / page name (eg.12.34.56.78:80/index.html) using XAMPP to open html page in the browser ?

Please guide me to overcome the above issues.

Regards

Posted by: Christian J Nov 5 2023, 09:22 AM

Greetings!

QUOTE(shankar from vizag @ Nov 5 2023, 12:05 PM) *

1. How to prevent USERS to access directly to the XAMPP phpmyadmin C-panel through browser.

In my understanding XAMPP is normally not meant to be accessible from the web. Are you using XAMPP as an online web server?

QUOTE
2. Can I define a name instead of IP address / page name (eg.12.34.56.78:80/index.html) using XAMPP to open html page in the browser ?

You mean like a domain name, but on your local computer? unsure.gif


Posted by: shankar from vizag Nov 5 2023, 08:38 PM

Greetings!

Thank you so much for the reply Mr. Christian J

[quote name='shankar from vizag' post='146664' date='Nov 5 2023, 12:05 PM']
1. How to prevent USERS to access directly to the XAMPP phpmyadmin C-panel through browser.
[/quote]
In my understanding XAMPP is normally not meant to be accessible from the web. Are you using XAMPP as an online web server?

I am using XAMPP server in my local intranet. I had noticed that the client is easily accessing the control panel of XAMPP phpmyadmin page. I want to restrict the access from client side at the same time client should able to access my php page. This is my intention.

[quote]2. Can I define a name instead of IP address / page name (eg.12.34.56.78:80/index.html) using XAMPP to open html page in the browser ?[/quote]
You mean like a domain name, but on your local computer? unsure.gif

yes, like

Instead of 12.34.56.78:80/index.html
like index.html
[/quote]

Posted by: Christian J Nov 6 2023, 08:05 AM

QUOTE(shankar from vizag @ Nov 6 2023, 02:38 AM) *

I am using XAMPP server in my local intranet. I had noticed that the client is easily accessing the control panel of XAMPP phpmyadmin page. I want to restrict the access from client side at the same time client should able to access my php page. This is my intention.

Maybe this could work, but I haven't tried myself: phpmyadmin > User Accounts > root Edit Privileges > Change Password.
https://stackoverflow.com/questions/12224431/create-a-root-password-for-phpmyadmin/42092752#42092752

QUOTE

QUOTE
2. Can I define a name instead of IP address / page name (eg.12.34.56.78:80/index.html) using XAMPP to open html page in the browser ?

You mean like a domain name, but on your local computer? unsure.gif

yes, like

Instead of 12.34.56.78:80/index.html
like index.html

You can use http://localhost/index.html (or better http://localhost/foo/index.html, http://localhost/bar/index.html etc if you have multiple projects).


Posted by: CharlesEF Nov 14 2023, 06:42 PM

QUOTE(shankar from vizag @ Nov 5 2023, 05:05 AM) *

Greetings

Please suggest simpler ways for the following two issues:

2. Can I define a name instead of IP address / page name (eg.12.34.56.78:80/index.html) using XAMPP to open html page in the browser ?

Please guide me to overcome the above issues.

Regards

I seem to remember you can use the HOSTS file for this. As long as it is for your local computer. Both *nix/Windows has one. In Windows it is hidden, so you have to be sure to show hidden files. This file is part of the O/S, it has nothing to do with the web server. But you may have to restart the web server after you make changes to the HOSTS file.

Posted by: Christian J Nov 14 2023, 08:36 PM

QUOTE(CharlesEF @ Nov 15 2023, 12:42 AM) *

I seem to remember you can use the HOSTS file for this.

That's how it works with a standalone Apache server, but I wonder if the HOSTS file is necessary with XAMPP? I made a test directory in XAMPP's htdocs directory:

CODE
C:\xampp\htdocs\test

and put an index.html file inside it. After starting XAMPP's Apache server I could then access the HTML page in a browser right away at this URL:

CODE
http://localhost/test/

Posted by: CharlesEF Nov 15 2023, 05:02 AM

If I remember correctly you could use the HOSTS file to change 'localhost' to 'example.com', for example.

Posted by: Christian J Nov 15 2023, 10:12 AM

QUOTE(CharlesEF @ Nov 15 2023, 11:02 AM) *

If I remember correctly you could use the HOSTS file to change 'localhost' to 'example.com', for example.

Yes, or redirect 'example.com' to localhost (can be used to block advertizing domains).

But to acess my own pages it seems I still need to use "http://localhost/example.com". With just http://example.com (after making a directory called "/example.com/", as well as an entry in the hosts file) I just see XAMPP's welcome page in my browser. unsure.gif

BTW, note that some Windows anti-malware programs may protest if you edit your hosts file, mine was even reset one time.

Posted by: CharlesEF Nov 15 2023, 03:55 PM

As I said, it has been many years since I messed with the HOSTS file, so my memory many be off. Once you change the HOSTS file don't you need to reboot before the entry takes effect? Also, to access pages on my development computer I only use 'localhost:81'. I have several sites with different ports. My web server is Windows IIS.

Posted by: Christian J Nov 15 2023, 04:13 PM

QUOTE(CharlesEF @ Nov 15 2023, 09:55 PM) *

As I said, it has been many years since I messed with the HOSTS file, so my memory many be off.

Same here, and then I used standalone Apache (without XAMPP).

QUOTE
Once you change the HOSTS file don't you need to reboot before the entry takes effect?

Not Windows, but it seems you need to reboot the browser.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)