準備
安裝WSL1 Ubuntu-18,04
https://wsldownload.azureedge.net/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx
步驟
sudo apt update
sudo apt-cache pkgnames | grep php7.2 | xargs sudo apt install -y
sudo apt install apache2
sudo a2enmod rewrite
sudo apt install memcached
sudo /etc/init.d/memcached restart
sudo apt install php-memcached
sudo apt install redis-server
sudo /etc/init.d/redis-server restart
sudo apt install php-xdebug
#或者使用sudo pecl install xdebug安裝
vi /etc/php/7.2/mods-available/xdebug.ini
zend_extension=xdebug.so
;如果使用pecl安裝xdebug,使用如下語句
;zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = On
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = "/var/log/php/xdebug-profiler.log"
xdebug.profiler_output_dir ="/var/log/php/tmp"
xdebug.show_local_vars=0
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
;xdebug.remote_log="/var/log/php/xdebug.log"
xdebug.default_enable = "On"
xdebug.remote_handler = "dbgp"
xdebug.idekey = PHPSTORM
xdebug.coverage_enable=0
VSCode XDebug pathMappings
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9001,
"pathMappings": {
"/mnt/e/Projects/Tcct": "${workspaceRoot}"
}
}
]
}
sudo touch /etc/apache2/site-available/001-tcct.conf
# 測試站點
Listen 10080
<VirtualHost *:10080>
ServerName localhost
DocumentRoot "/mnt/e/Projects/Tcct/public"
<Directory "/mnt/e/Projects/Tcct/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
sudo a2ensite 001-tcct
sudo /etc/init.d/apache2 reload