Xdebug install (php.ini) OS X 10.8 (Mountain Lion) - php

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

Related

php7.4 Xdebug xdebug.mode = debug is not working for me

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.

Problem xcode no work xcode/MAMP/PhpStorm/Mac

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

Where is xdebug config on homebrew httpd/php?

I am working on MacOS High Sierra and have httpd 2.4 and php 7.1 installed via homebrew. I have php.ini file in /usr/local/etc/php/7.1/php.ini (with extra files in /usr/local/etc/php/7.1/conf.d, including ext-xdebug.ini.
This xdebug.ini contains the following:
[xdebug]
zend_extension="/usr/local/opt/php71-xdebug/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9001
xdebug.idekey=INTELLIJ
If I run on command line php -i |grep xdebug, I get all the xdebug settings, including the ones above.
Yet, if I put a php file into the web root with phpinfo() in it and access it via the browser, I get the following (among other):
xdebug.remote_enable = false
xdebug.remote_port = 9000
xdebug.idekey = _www
Where are these values set? I can't find any other config file anywhere.
This was silly of me. After updating php.ini, I restarted apache, but I didn't restart php-fpm. Naturally, as the php process was still running, it had cached the settings. After I restarted php-fpm (brew services restart php71) the new settings were picked up and debugging now works as expected.

Can't locate xdebug.so on linux

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

How to enable XDebug extension on my php?

I am running php on a macbook pro running mountain lion.
Mountain lion comes with XDebug pre-installed, so based on a tutorial I've found , I made three steps.
First I've uncomment this line in my php.ini :
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
Secondly I've uncomment this line in my php.ini :
xdebug.remote_enable=1
And finally I restarted the apache server with :
sudo apachectl restart
The problem is that I see no xdebug appearing in my php details when I run a phpinfo().
Thank you.
PS : The path of the above xdebug.so file is correct.
I am answering my own question because Mountain Lion is a special case when it comes to running XDebug.
As you can see here,
mountain lion comes with an older xdebug.so library. So the user must re-compile the library himself.
Here is how to do it.
Download the latest version here. (We get the file under the
source link.)
Unpack the downloaded file with tar -xvzf xdebug-2.2.1.tgz
Run cd xdebug-2.2.1
Run phpize
Run ./configure
Run make
Run sudo cp modules/xdebug.so
/usr/lib/php/extensions/no-debug-non-zts-20090626
Restart the web server with sudo apachectl restart
Check you are editing the same php.ini that shows up in phpinfo() in the broswer.
Here are my settings (I'm also on a Macbook Pro on Mountain Lion btw):
xdebug.var_display_max_children = 999
xdebug.var_display_max_data = 99999
xdebug.var_display_max_depth = 100
;zend_extension_ts=php_xdebug.dll
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Works for me. Does any of that help?
This set of instructions worked for me.
It successfully uses OSX Mountain Lion's native Apache2 and XDebug together with MacGDBp and a Safari extension called XDebug Helper.

Categories