Бял Ден лого   PHP with XDebug
2025.09.22 редактирана

Follow these steps to install and configure PHP and XDebug to debug scripts locally with build-in development server.

1. Install PHP 7.4.33
• download from https://windows.php.net/downloads/releases/archives
select version php-7.4.33-Win32-vc15-x64.zip
unzip in folder C:\PHP74\
• add Environment variable PATH
WinKey > Environment variables > User variable for username
select line "Path"
click [Edit]
click [New]
add string "C:\PHP74"
• verify PATH in command prompt
> php -v
PHP 7.4.33 (cli) (built: Nov 2 2022 16:00:55) ( ZTS Visual C++ 2017 x64 )


2. Create php.ini:
• copy C:\PHP74\php.ini-development to C:\PHP74\ php.ini
• In php.ini , uncomment ;extension lines ( remove ; )
;extension=curl
; On windows:
;extension_dir = "ext"

• add new lines in the end :
; This loads the Xdebug extension
zend_extension = C:\PHP74\ext\php_xdebug.dll
; Enable Xdebug
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host = 127.0.0.1
xdebug.log = "C:\PHP74\xdebug.log"


3. Install Visual C++ Redistributable (VC15)
https://aka.ms/vs/16/release/vc_redist.x64.exe
If has error: Another version is already installed , do nothing.

4. Install XDebug
https://xdebug.org/download/historical
version PHP 7.4 VC15 TS (64 bit) // XDebug version has to be compatible with PHP version
copy php_xdebug-3.1.6-7.4-vc15-x86_64.dll in folder C:\PHP74\ext\
C:\PHP74\ext\php_xdebug-3.1.6-7.4-vc15-x86_64.dll

5. Install "PHP Debug" extension
In VSCode > Extensions tab > search for "PHP Debug" by XDebug

---- debugging --------

6. Copy files in folder:
C:\demo\demo.html
C:\demo\command.php

7. Start PHP server in the same folder
PS C:\demo> php -S localhost:8000
PHP 7.4.33 Development Server (http://localhost:8000) started


8. Open the folder with VSCode
VSCode > Open folder > C:\demo
start [Run and Debug] > click create launch.json file
select "PHP" from dropdown list
save configuration file.
select command.php
put breakpoint in command.php
start [Run and Debug]

9. Open in browser
localhost:8000/demo.html    
demo.html triggers command.php and breakpoint is hit in VSCode.







2021-2025 Бял Ден ЕООД , email bqlden@yahoo.com , mobile 0889359737 . bqlden.com се съхранява на Zetta Hosting Solutions Llc.
всички материали се разпространяват безплатно.