Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deb12:lamp [2024/05/23 05:52] Bernard Condraudeb12:lamp [2025/11/17 14:53] (current) – [Create certificate for localhost] Bernard Condrau
Line 132: Line 132:
   - Make sure the xdebug configuration is loaded last (e.g., ''zend_extension'' directive must be below the line for OPcache)   - Make sure the xdebug configuration is loaded last (e.g., ''zend_extension'' directive must be below the line for OPcache)
   - Also update php.ini files in adjacent directories (//apache2// and //cli//), as your system might be configured with a separate php.ini file for the web server and command line.   - Also update php.ini files in adjacent directories (//apache2// and //cli//), as your system might be configured with a separate php.ini file for the web server and command line.
-  - Read [[web:eclipse#wsl_windows_subsystem_for_linux|WSL (Windows Subsystem for Linux)]] if you are running your LAMP server inside WSL+  - Read [[#wsl_windows_subsystem_for_linux|WSL (Windows Subsystem for Linux)]] if you are running your LAMP server inside WSL
   - Read [[https://xdebug.org/docs/upgrade_guide|Upgrading from Xdebug 2 to 3]] if you are upgrading   - Read [[https://xdebug.org/docs/upgrade_guide|Upgrading from Xdebug 2 to 3]] if you are upgrading
   - Restart your webserver after configuration changes   - Restart your webserver after configuration changes
Line 142: Line 142:
   * [[https://xdebug.org/docs/install|Xdebug: Installation]]   * [[https://xdebug.org/docs/install|Xdebug: Installation]]
   * [[https://xdebug.org/docs/all_settings|Xdebug: all settings]]   * [[https://xdebug.org/docs/all_settings|Xdebug: all settings]]
 +  * [[https://xdebug.org/docs/upgrade_guide|Upgrading from Xdebug 2 to 3]]
  
 ===== MariaDB 10.11.6 Installation ===== ===== MariaDB 10.11.6 Installation =====
Line 168: Line 169:
 icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F
 icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F /t</code> icacls X:\FULL_PATH_TO_FOLDER /grant Administrators:F /t</code>
 +
 +==== WSL1 with Xdebug ====
 +  * WSL1 runs networking in ''bridged'' mode
 +  * You do not need to set ''xdebug.client_host'' (Xdebug2: ''xdebug.remote_host'')
 +  * Will work with default configuration settings
 +==== WSL2 (NAT) ====
 +  * WSL2 set to ''NAT'' networking mode (default)
 +  * Your Linux box runs within a Hyper-V Virtual Machine
 +  * You can access the Windows host through the IP address stored in ''/etc/resolv.conf''
 +  * ''xdebug.client''_host must be configured to use this IP address. Separate the directive from the xdebug settings by copying it into a separate file to be loaded after the xdebug settings, then run a script to update this IP address before starting or restarting the LAMP server:<code>#!/bin/bash
 +IP=$(ip route show | grep -i default | awk '{ print $3}')
 +INI="/home/bco/conf/xdebug.host.ini"
 +echo -e "[Xdebug]" > $INI
 +echo -e "xdebug.client_host=$IP" >> $INI</code>
 +  * Check the xdebug logfile with ''tail -f /path/to/log/xdebug.log'' until this is working properly
 +
 +=== Windows host IP address ===
 +  * Alternatively you could use the Windows host IP address (feasible if it remains the same through re-boots) in which case you need to add a firewall rule to allow access through the xdebug port. Command to run in an elevated PowerShell:<code>New-NetFirewallRule -DisplayName "xdebug" -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" -Direction Inbound -Protocol TCP -LocalPort 9003 -Action Allow</code>
 +  * Commands to check or remove the firewall rule:<code>Get-NetFirewallRule -DisplayName "xdebug"
 +Remove-NetFirewallRule -DisplayName "xdebug"</code>
 +
 +==== WSL2 (mirrored) ====
 +  * WSL2 set to ''mirrored'' networking mode
 +  * This networking mode is available for Windows 11  23H2 and later
 +  * To enabled ''mirrored'' mode, save the following content as file ''.wslconfig'' into folder ''C:\Users\<user>'' on your Windows host<file>[wsl2]
 +networkingMode=mirrored</file>
 +  * Your Linux box runs within a Hyper-V Virtual Machine
 +  * You can access the Windows host through the IP address ''127.0.0.1'', no firewall rule is necessary
 +  * ''xdebug.client''_host must be configured to use this IP address
 +  * Check the xdebug logfile with ''tail -f /path/to/log/xdebug.log'' until this is working properly
 +  * Note that WSL in ''mirrored'' mode is less secure and can be directly accessed from your LAN
 +==== Links ====
 +  * [[https://gist.github.com/SomajitDey/68e8cd639e3bf592bded035630cf86ec|How to forward WSL2 port to Windows port and vice versa]]
  
 ===== SSL for localhost ===== ===== SSL for localhost =====
Line 204: Line 238:
     * You can check the domain names included in the original certificate:<code>openssl x509 -text < $CERT_FILE</code>     * You can check the domain names included in the original certificate:<code>openssl x509 -text < $CERT_FILE</code>
  
 +==== Trust localhost certificate on Windows 11 ====
 +  * Run ''certmgr.msc'', then select //Trusted Root Certification Authorities//
 +  * Right-click on //Certificates// and select //All Tasks --> Import...//. Import the ''RootCA.crt'' file and accept all questions with default answer.
 ==== Links ==== ==== Links ====
   * [[https://www.sslshopper.com/ssl-checker.html|SSL Checker]]   * [[https://www.sslshopper.com/ssl-checker.html|SSL Checker]]