Installing xdebug with PHP 5.5 - php

I've read quite a lot answers but couldn't figure out why xdebug doesn't work.
php.ini:
[xdebug]
zend_extension="/usr/lib/php5/20090626/xdebug.so"
php -v:
PHP 5.5.6-1+debphp.org~precise+2 (cli) (built: Nov 21 2013 14:31:41)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
/usr/lib/php5/20090626/xdebug.so does exist. No zend optimizer in php.ini.
Also if I try to install xdebug:
pecl/xdebug is already installed and is the same as the released version 2.2.3
install failed
Thanks in advance.

Ok so I've stumbled upon this myself.
First of all, the 20090626 lib is compiled for php 5.3. So you can't really use that. Here are the steps I've performed in order to be able to use xdebug with php 5.5:
Download the source via xdebug download page.
Follow this guide for compiling your source into lib.
So now the extension is in correct source folder: 20121212, and you need to enable xdebug in your config.
I'm on ubuntu 12.04, so next steps might not work with your system:
create 20-xdebug.ini config and copy it to both /etc/php5/apache/conf.d and /etc/php5/cli/conf.d folders (if you plan on using xdebug in your cli of course). Insert next line of code there: zend_extension=xdebug.so
enable xdebug in both apache2 and cli php.ini configuration files:
xdebug.remote_enable = 1
xdebug.renite_enable = 1
xdebug.max_nesting_level = 1000
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = '/var/log'
See more about xdebug settings: http://xdebug.org/docs/all_settings
php -v:
PHP 5.5.7-1+sury.org~precise+1 (cli) (built: Dec 12 2013 21:37:40)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Since this seems to bother more and more people trying to install xdebug via pecl here are the options:
Windows: Get the binary
Ubuntu (>12.04): sudo apt-get install php5-xdebug
Linux (other): via package manager or compile the latest source
Using PECL to install X-Debug for PHP5.5 as #Slayer Birden also answered will not work up to now and I don't think it will change in the near future.

I had a similar problem on Ubuntu 14.10. I forgot to enable xdebug:
sudo php5enmod xdebug
after installing xdebug from repository:
sudo apt-get install php5-xdebug
Also do not forget to restart web server
sudo service apache2 restart
My xdebug.ini looks like this:
zend_extension=xdebug.so
xdebug.remote_enable = 1

for xampp server first download xdebug and insert into php extention and edit php.ini file like this:
[XDebug]
; Only Zend OR (!) XDebug
; XAMPP and XAMPP Lite 1.7.0 and later come with a bundled xdebug at C:\xampp/php/ext/php_xdebug-2.3.1-5.5-vc11.dll, without a version number.
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
; Port number must match debugger port number in NetBeans IDE Tools > Options > PHP
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"
[PHP_XDEBUG-2.3.1-5.5-VC11]
zend_extension="C:\xampp\php\ext\php_xdebug-2.3.1-5.5-vc11.dll"

I ran into this problem today. Found out that the latest version on download page might actually not work. Download the one under Xdebug 2.3.0, select "PHP 5.5 VC11 TS (32 bit) (MD5: ef4a8994cef26c47ac891d6872e391b3)". It worked for me. I tried ver 2.3.3 and 2.3.2 before which did not work.

To install a very specific version of Xdebug for a specific version of PHP you can do it by compilation from sources. E.g. if you would like to compile xdebug-2.5.5 for PHP 5.6 run following commands in console (Ubuntu):
sudo apt install php5.6-dev
cd ~/Downloads
wget "https://xdebug.org/files/xdebug-2.5.5.tgz" -O "xdebug-2.5.5.tgz"
tar -xzf xdebug-2.5.5.tgz
cd xdebug-2.5.5/
/usr/bin/phpize5.6
./configure --enable-xdebug --with-php-config=/usr/bin/php-config5.6
make
sudo make install
All available versions of Xdebug can be found here. Xdebug compilation guide is here.

Related

PHP Xdebug not in php

hi i install homebrew install some brew things and now i need install Xdebug but when i write to terminal on mac php --version there is only version of php not version php with xdebug only version of php
$ php --version
PHP 7.2.8 (cli) (built: Aug 28 2018 16:32:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
help me i doo all things what i should but it not work correctly help thx
With the migration to Homebrew-core the php formula has stopped taking over the role of PECL. Installing xdebug can (and should) be done through PECL (https://pecl.php.net/package/xdebug).
pecl update-channels
pecl list-all
pecl install xdebug
or upgrade it
pecl upgrade xdebug
After that you'd need to update your php.ini with a line to specify xdebug's location, as suggested on xdebug.org:
zend_extension="/usr/local/php/modules/xdebug.so"
Additionally, you may need to put in there some settings for xdebug, for example:
xdebug.collect_vars=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_port=9005
Source: http://www.artemdwo.com/install-php72-and-xdebug-on-mac-os-x

Error while installing Xdebug in PHP version 5.6.32

I am new to PHP. I want to enable Xdebug in Eclipse IDE but when I check Xdebug for my version https://xdebug.org/wizard.php showing error:- here is what
Tailored Installation Instructions
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: yes - Compiler: MS VC11 - Architecture: x86
Zend Server: no
PHP Version: 5.6.32
Zend API nr: 220131226
PHP API nr: 20131226
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\Windows
Configuration File: E:\xampp1\php\php.ini
Extensions directory: E:\xampp1\php\ext
PHP versions below 7.0 are not supported.
If you like Xdebug, and thinks it saves you time and money, please have a look at the donation page.
Please help to install Xdebug in Eclipse. I've installed XAMPP, Eclipse PDT PHP.
It seams your PHP Version is too low for xdebug:
Your PHP: "PHP Version: 5.6.32"
xDebug log said: "PHP versions below 7.0 are not supported."
So, after you upgrade you PHP version and successfully install xdebug, you should see (example):
# php -v
HP 7.2.3 (cli) (built: Mar 8 2018 10:30:06) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
with Zend OPcache v7.2.3, Copyright (c) 1999-2018, by Zend Technologies
I wanted to update this question because it is still possible to install XDebug against 5.6 and may still be necessary for legacy applications.
The wizard won't help you if you need to install XDebug for an older version of PHP (<7); you'll have to read the documents and work out the process yourself.
At https://derickrethans.nl/xdebug-php5.html the author states that the older source is available for downloading and using with older versions of php, and that 2.5 is the last version to work with PHP 5.6. You can download xdebug 2.5 from https://xdebug.org/download.php (or other versions as required).
The instructions on how to do this are on the XDebug website but maybe a little hard to grasp. A rough guide for installing installing on a CentOS 7.5 with Php 5.6 would be:
wgets https://xdebug.org/files/xdebug-2.5.5.tgz
tar -xvzf xdebug-2.6.0.tgz
cd xdebug-2.6.0
phpize [troubleshoot: yum install php-devel]
./configure --enable-xdebug
make
create a directory keep the xdebug module: mkdir /usr/php/xdebug/255
cp modules/xdebug.so /usr/php/xdebug/255
Find the active php.ini using php -i or phpinfo() in a script.
Restart the webserver: sudo service httpd restart
Make sure XDdebug is reported as enabled.
Edit php.ini: sudo nano /etc/php.ini
Add (or whatever your preferred options are) to php.ini:
zend_extension="/usr/php/xdebug/255/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart = 1
xdebug.remote_port="9000"
xdebug.remote_connect_back=on
Configure your client to connect. I've had this working with vscode.
You can find more information at https://xdebug.org/docs/install.

Xdebug with VS Code on ubuntu not working

I am trying to debug php using xdebug on ubuntu 16.04 with Visual Studio code. I installed xdebug as per the instructions from the following site-Xdebug wizard. In the xampp the php version is shown as PHP Version 5.5.6 but when i run the command php -v in terminal, it shows
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017,
by Zend Technologies
I don't know if that may cause any problem. But, the real issue is that Debugger doesn't stop at any breakpoints. Also, it sometimes shows unverified breakpoint message. Sometimes it just runs and never stop at any breakpoints. The Xdebug options don't fully show up in phpinfo() page even after the installation. I don't understand the problem.
make sure you have configure xdebug.ini file. here mine.
[xdebug]
zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_log=/var/log/apache2/xdebug.log
xdebug.default_enable = 1
xdebug.remote_enable=1
xdebug.remote_port=9000
sudo apt-get install php-xdebug

Installing xdebug on Ubuntu LAMP stack

I keep throwing this error but I have version 7.1.2 installed. Why can't I ./configure
Here is my error message:
checking whether to enable Xdebug support... yes, shared
checking Check for supported PHP versions... configure: error: not supported.
Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.3.10-1ubuntu3.26)
root#precise32:/var/www/xdebug# php -v
PHP 7.1.2-3+deb.sury.org~precise+1 (cli) (built: Feb 22 2017 10:29:40) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.2-3+deb.sury.org~precise+1, Copyright (c) 1999-2017, by Zend Technologies
root#precise32:/var/www/xdebug#
Has anyone else encountered this problem. I've tried reinstalling php 7.0 and several other tactics. Read through a bunch of different stack questions similar but I can't figure it out.
Which means I can't move on to: make
make install
cp modules/xdebug.so /etc/php.d/xdebug.so
You're using the PPA from Ondřej Surý. So you can easily install xdebug by using apt-get install php7.1-xdebug.
Edit: How-To configure Xdebug (on Ubuntu based Linux systems):
Create an ini file /etc/php/7.1/mods-available/custom.ini and put the following configuration into it:
; priority=90
[xdebug]
xdebug.remote_enable=1
; replace <Host-IP-Address> with the IP of your host system!
xdebug.remote_host=<Host-IP-Address>
; You'll need this later.
xdebug.idekey=PHPSTORM
xdebug.profiler_enable_trigger=1
Now activate the configuration with the command sudo phpenmod -v 7.1 -s ALL custom. Don't forget to restart your web server.
Second you need an IDE which supports the dbgp protocol. I use PhpStorm, it's fast (even it runs for hours) and of cause, it has a native Xdebug support.
After you've set up your IDE and set at least one breakpoint in your code, you can trigger the debugger very simple:
1st option: Add the query parameter XDEBUG_SESSION_START=PHPSTORM (where PHPSTORM is the value of the xdebug.idekey setting in your configuration file).
2nd option: Send a cookie with the content XDEBUG_SESSION=PHPSTORM with your request. cURL example: curl -H 'Cookie: XDEBUBG_SESSION=PHPSTORM' http://my-awesome.domain/awesome-script.php.
If you've set up anything correctly, you can now play with Xdebug.
Xdebug - Documentation
PhpStorm - Configuring Xdebug
PhpStorm - Zero-configuration Web Application Debugging with Xdebug and PhpStorm
And last but not least, some nice-to-have Xdebug settings:
; enable colors for the command-line interface
xdebug.cli_color=1
; show more data when using var_dump
xdebug.max_nesting_level=500
xdebug.var_display_max_children=512
xdebug.var_display_max_data=2560
xdebug.var_display_max_depth=200
; enable trigger for easy profiling
xdebug.profiler_enable_trigger=1
Have nice debugging sessions :)

Where do I tell Apache to use 5.6.23 instead of 5.5.9?

I am having a problem AFTER installing a newer version of PHP with the Apache web server seeing the new version 5.6.23...it is still using 5.5.9. Where do I tell Apache to use 5.6.23 instead of 5.5.9?
I am running a local web server on Linux Mint 17.1
As reported by phpinfo (both BEFORE installing php 5.6.23 and AFTER)
Apache Version: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.17
Apache API Version: 20120211
PHP Version: 5.5.9-1ubuntu4.17
Configuration File (php.ini) Path: /etc/php5/apache2
Loaded Configuration File: /etc/php5/apache2/php.ini
Scan this dir for additional .ini files: /etc/php5/apache2/conf.d
Noticing that newer versions of PHP are available (such as 5.6.23) but, evidentily not from the default repositories for Linux Mint 17.1, I decided to do the following:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
After restarting the web server (end even rebooting linux), I executed the following:
php -v
PHP 5.6.23-2+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
I verified the following:
5.5.9 is located here: /etc/php
5.6.23 is located here: /etc/php/5.6
Somewhere setting "Configuration File (php.ini) Path" will do the trick, but I do not know where to do this?
Thanks
Mike

Categories