切口下方是关于如何通过Linux子系统Windows 2(WSL 2)设置便利的环境来使用PHP,xdebug的小注释。

一,一点历史
我在Ubuntu的世界生活了很长的时间-在运行一切的同一系统上立即用PHP,NodeJS和GoLang编写代码非常令人愉快。但是,不幸的是,拥有管理职位会导致这样一个事实,即您必须使用许多只能在Windows上运行的软件。
" SSH". PhpStorm, ssh Ubuntu — .
— :) 100500 Phpstorm dell e7390:) , sftp.
WSL2 (http://habr.com/ru/news/t/516054) .
WSL Windows . Microsoft
PowerShell wsl Linux, Windows

Ubuntu:
sudo apt update
sudo apt upgrade
sudo apt install apache2
sudo apt install php libapache2-mod-php php-mysql php-xml php-curl
sudo a2enmod rewrite
/mnt/d/work/projects/__. , , Linux, . , , .
( ), , php Linux, NTFS . .
- WSL .
/home/user/projects - ( GIT).
/home/user/projects/test -
\\wsl$\Ubuntu"Ubuntu" — .\\wsl$

- PhpStorm

- ( , xdebug)

- Automatic upload

- WSL
— . = . . , rsync , . , — :)
Apache, . , , php-fpm nginx — .
xdebug
xdebug . .
xdebug
sudo apt-get php-xdebug
sudo nano /etc/php/7.2/mods-available/xdebug.ini
zend_extension=xdebug.so xdebug.remote_enable=true xdebug.remote_host=wsl.host xdebug.remote_port=9002 xdebug.profiler_enable=1 xdebug.profiler_output_dir=/tmp xdebug.remote_autostart=on xdebug.idekey=PHPSTORM xdebug.remote_log=/tmp/xdebug.log
apache
sudo service apache2 restart
xdebug . /etc/hosts wsl.host. IP , windows.
, , xdebug.remote_host=127.0.0.1, WSL , 127.0.0.1 linux linux, windows. , PhpStorm :)
-
github C# , Windows . , - Windows .
"" bash , IP /etc/hosts linux WSL — github.
. " ", systemd rc.local wsl . , .
wsl , /etc/hosts wsl.host linux windows. - , .
wsl , — cat /etc/hosts - :
172.26.64.1 wsl.host
xdebug PhpStorm Windows
WSL PhpStorm
File->Settings->Languages & Framework->PHP
"From Docker, Vagrant, VM, WSL, Remote"
WSL
, xdebug

File->Settings->Languages & Framework->PHP->Debug
, WSL ( 9002, 9000)
advanced "Pass required configuration options.."

, — wsl.host 127.0.0.1 .
, .. HTTP ini .
— .
- breakpoint index.php
- ,
-
Php Script

,

因此,在浏览了几种不同的来源,文章和要点之后,我在使用PHP时来到了一个“几乎理想的”工作环境。如果有任何可以改进的地方,请在评论中写或以其他任何方式与我联系。