pecl channel-update pecl.php.net
pecl clear-cache
pecl install xdebug
# Optional command
pecl clear-cache
- Edit your
ext-xdebug.ini
- Your
ext-xdebug.ini
file path should look like this (depends on php version installed)/usr/local/etc/php/7.4/conf.d/ext-xdebug.ini
- Add these lines by overwriting exiting
# Configuration for Xdebug 3
[Xdebug]
;zend_extension="/usr/local/Cellar/php@742/7.4.11/pecl/20170718/xdebug.so"
zend_extension="xdebug.so"
xdebug.mode=debug,develop
xdebug.start_with_request=default
xdebug.idekey=PHPSTORM
xdebug.client_port=9003
xdebug.file_link_format=phpstorm://open?%f:%l
-
Update your
php.ini
-
When installing xdebug extension using
pecl
, it also updates ourphp.ini
file, but we don't need that. -
Find your
php.ini
file, file path should look like this (depends on php version installed)/usr/local/etc/php/7.4/php.ini
-
Remove any occurrence of
zend_extension="xdebug.so"
from this file -
Restart the apache server to reflect changes
sudo apachectl -k restart
-
Configure phpStorm
-
Go through - Settings >> PHP >> Debug
-
Ensure that 'Debug port' is the same as you have in your
ext-xdebug.ini
. In our case it was9003
. -
Save and close the Settings Dialog
-
Start debugging
-
Create some breakpoints in your project
-
Make sure those breakpoints gets executed when your visit your website in browser.
-
Start listener by clicking on the telephone 📞 button on top toolbar
-
If you can't find telephone button; then go through menus - Run -> Start listening for PHP Debug Connections
-
Use chrome extension
-
Configure this chrome extension and set IDE Key to
PHPSTORM
-
Visit your website
-
You should see a popup window in PhpStorm , click Accept connection
-
Done, enjoy debugging !!!
@ankurk91
when i try to debug some code it says that some googlecrome thingy aint installed even tho i have all browser other then the installed firefox unchecked ... also i have trouble editing the ini file as it's read.only so i learned i have to start my editor from console with the sudo command and then i changed it; saved it; restarted all and the problem was still there ... iam sure is something because iam such a noob on ubunto/Linux in general ... on my win10 gameing pc i got it right on 1st attempt ...
ty for takeing the time on a sunday morning and answering my silly helplessness :)