WIN XAMPP端口占用及配置虚拟主机解决方案

其实PHP集成环境有很多,为什么使用XAMPP呢,这个没有太多的理由,如果非得说一个的话,那就是PHP官方第一推荐,见下面截图:
在这里插入图片描述
https://www.php.net/manual/zh/install.windows.tools.php

一、端口占用
启动XAMPP集成环境log报错如下:

15:11:13  [Apache]  Error: Apache shutdown unexpectedly.
15:11:13  [Apache]  This may be due to a blocked port, missing dependencies,
15:11:13  [Apache]  improper privileges, a crash, or a shutdown by another method.
15:11:13  [Apache]  Press the Logs button to view error logs and check
15:11:13  [Apache]  the Windows Event Viewer for more clues
15:11:13  [Apache]  If you need more help, copy and post this
15:11:13  [Apache]  entire log window on the forums

解决办法:
1、xampp7.3.30\apache\conf\httpd.conf修改端口号

#Listen 80
Listen 777

2、xampp7.3.30\apache\conf\extra\httpd-ssl.conf注释掉

#Listen 443

重新启动,问题解决!

15:19:24  [Apache]  Problem detected!
15:19:24  [Apache]  Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID 7628!
15:19:24  [Apache]  Apache WILL NOT start without the configured ports free!
15:19:24  [Apache]  You need to uninstall/disable/reconfigure the blocking application
15:19:24  [Apache]  or reconfigure Apache and the Control Panel to listen on a different port
15:19:24  [Apache]  Attempting to start Apache app...
15:19:24  [Apache]  Status change detected: running

二、配置虚拟主机
1、C:\Windows\System32\drivers\etc\host文件添加代码:

127.0.0.1 xx.local.com

2、xampp7.3.30\apache\conf\extra\httpd-vhosts.conf添加

<VirtualHost *:777>
    DocumentRoot "项目地址" #注意public目录
    ServerName xx.local.com #与host文件域名保持一致
	<Directory "项目地址"> #没有这4行,有问题
		AllowOverride All 
		Require all granted
	</Directory>
</VirtualHost>

3、浏览器访问xx.local.com,配置ok !!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值