windows 下 使用wsl配置php环境

2020-03-06  本文已影响0人  Swerve

wsl已知bug
netstat 不工作

安装wsl

如果旧wsl有问题,可能需要重新安装wsl

  1. 卸载 wsl https://blog.littlelanmoe.com/exp/494
  2. 重新安装wsl

wsl中安装环境

  1. 安装Apache apt-get install apache2
  2. 安装php apt-get install php7.1
  3. Apache安装php模块 apt-get install libapache2-mod-php
  4. 使用ln -s 将wsl /mnt/...中的文件夹链接到/var/www/html中。

apache的网站文件必须在/var/www/html中。wsl中的mnt下面就是windows的 C、D、E盘

  1. 解决(92)Protocol not available: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT
    https://github.com/microsoft/WSL/issues/1953
  2. Apache 开启重写 http://asika.windspeaker.co/post/3471-start-with-ubuntu-apache-the-mod-the-rewrite-set
  3. 配置域名需要wsl和windows都改写hosts

可以开始了

可以使用windows上的IDE打开windows磁盘上的项目文件,而这个路径又在wsl中的/mnt中。
上面我们又把/mnt的路径映射到了apache的/var中。
这时候IDE编辑的文件,其实就是apache中的文件。
也就实现了windows下修改,linux下运行,windows下验证

上一篇 下一篇

猜你喜欢

热点阅读