问题
My Apache Ports are set to:
80 and 443
Looking at the XAMPP control panel a few hours later, I noticed the Ports had changed to:
05 and 59895
- Would XAMPP switch to these Ports automatically for some reason after several hours?
- Is there a danger in using/opening these Ports?
回答1:
Same problem was answered in this post by one of XAMPP developers. Assuming this is real (quote):
In short, that is normal. Apache listens for and accepts requests on ports 80 and 443 but it does not service requests on those ports. When you or others connect to your servers, they will be handled by other connections usually using high ports. The control panel just looks for all ports associated with a module. It is just picking up those client ports and the box to show all the ports is just not big enough to show them all.
回答2:
This is the full scenario i am explaining here that will clear you out :
We get a php page not responding, the first thing comes to our mind is : Is the apache service running on xampp ?
we immediately go to the xampp to check, and what we see is , the port is not 80 !!! Definitely every one will deduce the result that its port issue (same case happened to me) .
While its not the port issue. infact xampp changes the ports for it self. while requests are recieved on 80 as normal.
The real issue at that time is : that our code is not connecting to Database
.
Hence . please keep in mind, there is no issue in that. Your apache is fine. Just go and check your db connection !! and cheers :)
回答3:
Have you got skype? Because automatically skype uses port:80 and or 443.
Try to change it.
回答4:
I experienced this behaviour when using XDebug.
Everything in XAMPP was very slow, phpmyadmin or any website. Ports were changing almost on every request.
Commenting [XDebug]
block on php.ini
was my solution.
回答5:
If you have Xdebug installed there might be problem as XAMPP and Xdebug have some up-and-down scenarios. Check whether Xdebug is listening to PHP. if yes disable or deactivate that listening till you finalize with the database.
回答6:
Please make sure that you have given right port number after your host if your My SQL required port, Generally we don't required Port in Host value.
I just made this mistake and found it.
回答7:
Well, I had this problem so I got here.
I understand that this is not a problema with xampp so I started to check my code.
I was working with this code last friday.
$conn = new mysqli($host, $user, $pass, $database);
Today the code wasn't working so I have updated to this:
$conn = new mysqli($host."8000", $user, $pass, $database); //8000 is the apache port, you can change it to 80
It work's fine for me!
Hope this help you guys
回答8:
In my case problem with xdebug in some case solution update xdebugg file from xdebug site https://xdebug.org/download.php if it not work please comment xdebug code in php.ini
回答9:
I was also facing the same issue in my local PC.
I was trying with URL
127.0.0.1/project-name
Then i tried with URL
http://localhost/project-name
and it worked. I don't know how but it worked.
回答10:
you might be checking the current daemon/process ids through XAMPP control panel ..xampp does not changes port numbers on it's own.. restart your system or restart apache and you will find these numbers again changed to some other numbers..
i hope this resolves both of your queries..
回答11:
I've came across the same issue.
In my case I found a "strange" proxy config in httpd.conf.
As soon as I commented out the following lines, the issue disappeared:
<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>
来源:https://stackoverflow.com/questions/13130952/xampp-ports-change-on-its-own