I'm having some problems getting xdebug running on ElementaryOS (Ubuntu 16.04.2) with php7, and Apache2.
I installed it with sudo apt-get install php-xdebug. The install didn't report any errors. I've added
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 ; Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
to /etc/php/7.0/apache2/php.ini.
I also need to add the xdebug.so file location like, zend_extension="/path/to/xdebug.so". However, I have been unable to find xdebug.so after the install.
Does anyone know where xdebug.so is, or has the instructions changed since php7.0 was released. Most of the instructions/help seem to be for php5 online.
Thanks.
Check xDebug is installed.
php -m
Run locate xdebug.so
Returns /usr/lib/php/20151012/xdebug.so for me, but 20151012 might change in the future.
You have to execute sudo updatedb if locate does not return anything or you've just installed locate
For the new versions just add xdebug file name, example:
zend_extension=xdebug.so
xdebug.default_enable = 1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
...
If it does not work use Linux find command like the following:
find / -name "xdebug.so"
What does this command do?
Find = just find
/ = in all of directories inside / (all)
-name "xdebug.so" = with name equal to xdebug.so
Create a file with phpinfo(). Find the item extension_dir. There you'll see where the xdebug.so resides. Mine is:
/usr/local/lib/php/extensions/no-debug-non-zts-20170718
Related
I have installed Xdebug on a Ubuntu 20.04 system. I followed this documentation , which I found to be quite well written, and got everything installed per the specs. (I used apt rather than yum, and placed the .so file into /usr/lib/php/20190902 folder rather than the document's example.)
In that document, there is a reference to adding to the php.ini file (I added to /etc/php/7.4/apache2/php.ini and /etc/php/7.4/cli/php.ini files). Since the article doesn't specifically mention "sections" of the .ini file, I put them within the [PHP] section. (This is consistent with the remark about putting right before the Quick Reference bit.) I restarted Apache2 and the phpinfo() output now includes Xdebug, which it did not include before. All well and good.
The trouble I'm having is that although I set xdebug.mode = debug in the php.ini files, the phpinfo() output tells me that xdebug.mode is set to develop. Consequently, Step debugger shows as Disabled in my configuration. I cannot see why.
These are the lines I've added to each of those php.ini files:
zend_extension=xdebug.so
#zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug,develop,trace
[xdebug]
xdebug.remote_host=localhost
xdebug.remote_connect_back=0
xdebug.remote_enable=1
xdebug.remote_port=9900
xdebug.idekey="PHPSTORM"
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_handler=dbgp
xdebug.show_error_trace = 1
xdebug.log_level = 7
xdebug.start_with_request=yes
xdebug.mode=debug,develop,trace
And here are the key excerpts from the phpinfo() output:
On a whim, I tried placing all of those settings also within a new section of php.ini which I called [xdebug]. When that didn't work, I tried [Xdebug]. I restarted Apache2 after each attempt, but the symptom never changed.
What might I be missing?
For me, being on Ubuntu 22, PHP 8.1 and xdebug 3.1.2, the solution was to edit not the php.ini file but the xdebug.ini. For example :
sudo nano /etc/php/8.1/cli/conf.d/20-xdebug.ini
After this a restart for apache
sudo service apach2 restart
Then I was able see the changes in phpinfo and finally connect to PHPStorm debugger.
I have been through the forums without success. I'm trying to use xcode with PhpStorm on my pimp. I use MAMP/PHP 7.1.19.
When I do a phpinfo() I have nothing about Xdebug.
I have two php.ini files:
-/Applications/MAMP/conf/php7.3.0/php.ini
-/Applications/MAMP/bin/php/php7.3.1/conf/php.ini
I modified both files with:
-zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so"
I have of course check if the file xdebug.so exists.
If the file xdebug.so exists then you have to enable it in the php.ini. At the end of the file you have uncommented the zend_extensionbut you have to enable it. Add this:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php7.3.1/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_log="/usr/local/var/log/httpd/xdebug.log"
xdebug.default_enable=0
xdebug.profiler_enable=0
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.var_display_max_depth=1000
For someone else who doesn't have the xdebug.so file, you have to install the Xdebug extension with PECL. Open the terminal and paste:
cd /Applications/MAMP/bin/php/php7.3.1/bin and then install xdebug ./pecl install xdebug
I'm trying install xdebug on sublime3. I installed with package control and added the following code in php.info:
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log="/var/log/xdebug/xdebug.log"
But it doesn't even list in the info.php. The documentation says to add
zend_extension="/wherever/you/put/it/xdebug.so"
But I can't find the location of .so in the Fedora that I'm using, and I guess it's because I downloaded it with package control. Can anyone help?
Run php -i | grep extension_dir in your terminal to see where the extensions for PHP are installed.
I am trying to get XDEBUG up and going but having trouble getting the cookie to show. Below is what is put in my php.ini file. I restarted apache. I did a phpinfo() call and I do see xdebug enabled and the settings set. But when I do a localhost/?XDEBUG_SESSION_START=1 I am expecting to see a Cookie set to 1 in my browser right ?
zend_extension ="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.profiler_output_dir="/tmp"
when I run php -m I do not see it but I do see it in phpinfo
couldnt figure the exact answer but I went and downloaded the php.ini.default file from repo and set the following in the php ini
zend_extension ="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.idekey=foo
xdebug.profiler_enable=On
and it worked. could of been because of remote host. who knows. it worked. this is the bare minimum configurations for mac and this is if your going by the follwing installations for xdebug on mac
http://kubyshkin.ru/posts/installing-php-xdebug-extension-on-mac-os-x-10-7-lion.html
I have a problem enabling xdebug.
After installation it is not listed in phpinfo.
What I do:
1. sudo cp /etc/php.ini.default /etc/php.ini
2. Uncommented this line of the php.ini file:
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
3. sudo apachectl restart
After this the php stopped working, only html pages were visible.
So I do the following:
4. sudo rm /etc/php.ini
5. Uncommented this line of the php.ini.default file:
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
6. sudo apachectl restart
After this the php was working again, but in phpinfo was not any xdebug entry and it didn't work in Netbeans.
How can I install xdebug?
Please use the wizard to help you figure out how to compile: http://xdebug.org/wizard.php
I think you also need the following settings in your php.ini file. Amyway, this is what is working for me:
[xdebug]
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable=on
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Also make sure that the /tmp/xdebug/ folder and the /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so file exist.
to add to Jean-François Beauchamp answer:
to create the xdebug.profiler_output_dir
sudo touch /tmp/xdebug
also i had to create a php.ini file
sudo cp /etc/php.ini.default /etc/php.ini