Debug php apps with xdebug in PHPstorm
-
Upload
- -
Category
Technology
-
view
255 -
download
4
Transcript of Debug php apps with xdebug in PHPstorm
![Page 1: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/1.jpg)
Стадник Андрей quazarweb.ru [email protected] @StadnikAndrey
Отладка приложений при помощи xDebug в PhpStorm
![Page 2: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/2.jpg)
Способы отладки
1. Дамп переменных 2. Отладка кода 3. Профилирирование кода
![Page 3: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/3.jpg)
Дамп переменных
echo '<pre>' . print_r($variables) .'</pre>';
Devel dsm(); dpm()
var_dump($variables)
'</pre>'
1.
2.
3.
'<pre>' $variables ..
Devel
$variables
![Page 4: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/4.jpg)
Дамп hook_preprocess_page()
ТЕГ <pre>
![Page 5: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/5.jpg)
Дамп hook_preprocess_page()
модуль Devel
![Page 6: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/6.jpg)
Дамп hook_preprocess_page()
VAR_DUMP($VARIABLES)
![Page 7: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/7.jpg)
Дамп hook_preprocess_page()
xdebug запуск отладчика
![Page 8: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/8.jpg)
Дамп hook_preprocess_page()
xdebug точка остановки
![Page 9: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/9.jpg)
Дамп hook_preprocess_page()
xdebug переменные в точке остановки
![Page 10: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/10.jpg)
Отладка в XDebug1.Продолжить отладку до точки2.Перейти к исполняемой строке3.Войти в функцию4.Войти внутрь минуя конструкторы5.Выполнить функцию не заходя в нее6.Выйти из функции7.Перейти к курсору8.Остановить отладку
![Page 11: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/11.jpg)
Фичи PhpStormВыполнить расчет
![Page 12: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/12.jpg)
Фичи PhpStormWatcher
![Page 13: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/13.jpg)
Фичи PhpStormУсловия приостановки программы
![Page 14: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/14.jpg)
Фичи PhpStormСложные условия приостановки программы
![Page 15: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/15.jpg)
Фичи PhpStormСложные условия приостановки программы
Результат вывод в консоль и расчет выражение в консоли
![Page 16: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/16.jpg)
Фичи PhpStormЕще сложнее, условия приостановки программы
![Page 17: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/17.jpg)
Профилирование кода
![Page 18: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/18.jpg)
Профилирование кода
![Page 19: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/19.jpg)
Профилирование кода
![Page 20: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/20.jpg)
Профилирование кода
![Page 21: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/21.jpg)
Профилирование кода
![Page 22: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/22.jpg)
Настройка//Конфиг xDebug в php.inizend_extension=xdebug.so xdebug.default_enable = On xdebug.var_display_max_depth=6 xdebug.remote_enable=on xdebug.remote_host=127.0.0.1xdebug.remote_port=9000xdebug.remote_handler=dbgp xdebug.idekey=PHPSTORM xdebug.remote_autostart=1 xdebug.remote_log=/tmp/xdebug.log xdebug.profiler_enable_trigger=1 xdebug.profiler_enable=0xdebug.profiler_output_dir=/home/enemis/xdebug-profilerxdebug.show_local_vars=1xdebug.overload_var_dump=1xdebug.max_nesting_level = 10000
![Page 23: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/23.jpg)
Настройка
//Конфиг php.ini
html_errors = On
display_errors = on
![Page 24: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/24.jpg)
Почитать 1. Сайт XDebug xdebug.org 2. Библиотека для kcachegrid graphviz.org 3. Анализ профайлов kcachegrind.sourceforge.net 4. Заметка о Devel функциях xandeadx.ru/blog/drupal/304 5. Удаленная отладка XDebug habrahabr.ru/post/209024 6. xdebug port forwarding habrahabr.ru/post/146547 7. Мой сайт :) quazarweb.ru
![Page 25: Debug php apps with xdebug in PHPstorm](https://reader033.fdocuments.us/reader033/viewer/2022051101/5a6ebd207f8b9a4f608b4d65/html5/thumbnails/25.jpg)
Стадник Андрей quazarweb.ru [email protected] @StadnikAndrey