I just realised I dont have a post on how to install xdebug in centos7 with php7 and setting up xdebug and eclipse. Its a feature that I use every day, and I had assumed I already had a post, but when searching my site ) only found instructions for XAMPP and xdebug.
I’m assuming you already have apache / php installed and working, and that you only need to add xdebug. This post shows how to install xdebug in centos7 with php7.
If you dont alreay have php7 installed in your centos7, you can follow my other post here. Once you have php7 installed, you can then install xdebug with the following:
if you have php7 in centos7 with webtactic and epel you can install xdebug with the following
yum install php70w-pecl-xdebug.x86_64
if you have epel and webtactic, but not php7 you can install xdebug with:
yum install php-xdebug
Now that xdebug is in your sytstem its time to confgure xdebug
#this line will be added automatically zend_extension = /usr/local/lib/php/extensions/xxx/xdebug.so #add the following xdebug.remote_log="/tmp/xdebug.log" xdebug.profiler_enable = 1 xdebug.remote_enable=on xdebug.remote_port=9000 xdebug.remote_autostart=0 xdebug.remote_connect_back=on xdebug.idekey=editor-xdebug
You can find the correct paths to the files needed if you have yum-utils installed and run
repoquery --list php70w-pecl-xdebug # the output is: /etc/php-zts.d/xdebug.ini /etc/php.d/xdebug.ini /usr/bin/debugclient /usr/lib64/php-zts/modules/xdebug.so /usr/lib64/php/modules/xdebug.so /usr/share/doc/php70w-pecl-xdebug-2.4.1 /usr/share/doc/php70w-pecl-xdebug-2.4.1/CREDITS /usr/share/doc/php70w-pecl-xdebug-2.4.1/LICENSE /usr/share/doc/php70w-pecl-xdebug-2.4.1/README.rst /var/lib/pear/pkgxml/xdebug.xml
You now need to restart httpd
service httpd restart # or systemctl restart httpd.service
Xdebug will now be up and running
If you are running with SELinux enforement on, then you can run this command to let xdebug out:
setsebool -P httpd_can_network_connect 1
Inside eclipse, goto preferences > php > debuggers
change the debugger to xdebug
change the dropdown for “accept remote session (JIT)” to “any” or “prompt”
Xdebug Helper is the best solution I have found for firefox – simply install the extension from here, navigate to the site you want to debug, and click the little green bug, select debug and reload your page to open in your editors debugger. You might need to add the key you added to your xdebug.ini in the previous steps.
Xdebug Helper is the best solution I have found for chrome – simply install the extension from here, navigate to the site you want to debug, and click the little green bug, select debug and reload your page to open in your editors debugger. You might need to add the key you added to your xdebug.ini in the previous steps.