You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS系统下启动XAMPP的Apache服务失败求助

Fix XAMPP Apache Start Failure on CentOS ("Another web server is already running")

Hey there, let's work through this Apache conflict issue together. That error message tells us exactly what's going on—another web service is already using the default HTTP (80) or HTTPS (443) ports that XAMPP's Apache needs. Here's a step-by-step solution:

1. Identify which process is hogging the ports

First, we need to find out what's using ports 80 and 443. Run these commands in your terminal:

# Check for port 80
netstat -tulpn | grep :80

# Check for port 443
netstat -tulpn | grep :443

If netstat isn't installed, use ss instead (it's a more modern alternative):

ss -tulpn | grep :80
ss -tulpn | grep :443

Look for the PID/Program name column—this will tell you which service is using the port (common culprits are CentOS's native httpd service or nginx).

2. Stop and disable the conflicting service

Once you know the service, stop it and prevent it from starting automatically on boot:

  • If it's the native Apache (httpd):
    sudo systemctl stop httpd
    sudo systemctl disable httpd
    
  • If it's Nginx:
    sudo systemctl stop nginx
    sudo systemctl disable nginx
    
  • If it's a random process (not a system service), kill it directly using its PID (replace <PID> with the number you found):
    sudo kill -9 <PID>
    

Note: Double-check the process before killing it to avoid taking down critical services!

3. Verify ports are now free

Run the port-check commands again from step 1. If there's no output, that means ports 80 and 443 are available for XAMPP's Apache.

4. Restart XAMPP's Apache

Now start XAMPP again—Apache should launch without issues:

sudo /opt/lampp/lampp restart apache
# Or start all XAMPP services at once
sudo /opt/lampp/lampp start

Alternative: Change XAMPP Apache's ports (if you need the other web server running)

If you don't want to stop the conflicting service, you can reconfigure XAMPP to use different ports:

  1. Open the main Apache config file:
    sudo nano /opt/lampp/etc/httpd.conf
    
  2. Find the line Listen 80 and change it to something like Listen 8080 (pick any unused port).
  3. Next, edit the SSL config file:
    sudo nano /opt/lampp/etc/extra/httpd-ssl.conf
    
  4. Find Listen 443 and change it to Listen 4433.
  5. Save both files (Ctrl+O, then Enter, then Ctrl+X in nano) and restart XAMPP's Apache.
  6. Now access your XAMPP server using the new ports: http://localhost:8080 or https://localhost:4433

内容的提问来源于stack exchange,提问作者Mohd Shah Nawaz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:47:55