其实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 !!!!