Xdebug Profiler not working over apache - php

The issue is I get no output from Xdebug-Profiler if I request any page from my server over browser. If i call a script with php in terminal like
php /var/www/html/index.php
then the profiler's output will be created. So I guess my configurations are fine. Here the important setting from my phpinfo:
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable On On
xdebug.profiler_enable_trigger Off Off
xdebug.profiler_enable_trigger_value no value no value
xdebug.profiler_output_dir /home/duser/profiler /home/duser/profiler
xdebug.profiler_output_name testgrind.out.%t-%s testgrind.out.%t-%s
The output from https://xdebug.org/wizard.php for my phpinfo:
Xdebug installed: 2.5.4
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.6.30
Zend API nr: 220131226
PHP API nr: 20131226
Debug Build: no
Thread Safe Build: no
Configuration File Path: /etc
Configuration File: /etc/php.ini
Extensions directory: /usr/lib64/php/modules
You're already running the latest Xdebug version
I have read a lot of topics here, where people had similar problem and it was often rights issue. Therefore i created the profiler folder in my home directory with rights like:
drwxrwxrwx 2 duser duser 140 30. Jun 07:02 profiler
The server is running on Centos 7, SELinux is disabled. The Xdebug-debugger works fine. Any help will be appreciated.

The issue was, apache had no access to my /home/duser/profiler folder. The output from xdebug has to be saved in /var/www/html/ or the configuration needs adjustment, so that apache will have access to specific path.

Related

Install Xdebug through Installation Wizard

Can someone help me with a next step? Which software should I use and how do I go about? What is RedHat?
I have XAMPP installed. I have searched some solutions but my case is a bit different.
Below is the output from Installation Wizard (https://xdebug.org/wizard).
I do not know how to proceed from point "2.Install the pre-requisites for compiling PHP extensions." and onwards.
Summary
Xdebug installed: no
Server API: LiteSpeed V7.8 CloudLinux 1.2
Windows: no
Zend Server: no
PHP Version: 7.4.13
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: no
OPcache Loaded: yes
Configuration File Path: /opt/alt/php74/etc
Configuration File: /opt/alt/php74/etc/php.ini
Extensions directory: /opt/alt/php74/usr/lib64/php/modules
Instructions
1.Download xdebug-3.0.1.tgz
2.Install the pre-requisites for compiling PHP extensions.
On your RedHat system, install them with:
yum groupinstall "Development tools" && yum install php-devel autoconf automake
3.Unpack the downloaded file with tar -xvzf xdebug-3.0.1.tgz
4.Run: cd xdebug-3.0.1
5.Run: phpize (See the FAQ if you don't have phpize).
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
6.Run: ./configure
7.Run: make
8.Run: cp modules/xdebug.so /opt/alt/php74/usr/lib64/php/modules
9.Edit /opt/alt/php74/etc/php.ini and add the line
zend_extension = /opt/alt/php74/usr/lib64/php/modules/xdebug.so
Make sure that
zend_extension = /opt/alt/php74/usr/lib64/php/modules/xdebug.so
is below the line for OPcache.
10.Restart the webserver
You're reading the *nix (Linux) installation instructions.
Install link is at the top of the website.
That brings you to https://xdebug.org/docs/install.
The eighth line on the page: Windows, with help from a wizard.
Brings you to https://xdebug.org/wizard
With instructions to download files from https://xdebug.org/download.
And to copy the contents of your php.ini file in the textarea at https://xdebug.org/wizard.
After following those clear instructions you will need to restart your HTTP server or if you have no idea and don't mind a temporary mindless brute-force (for your current XP) just sacrilegiously reboot your computer.
Here is what is in my WAMP (Windows, Apache, MariaDB, PHP) server's php.ini file for XDebug:
[XDebug]
;When updating server dump phpinfo in to here to determine correct download: https://xdebug.org/wizard.php
zend_extension = "C:\MEDIA\INTERNET\WAMP\PHP\ext\php_xdebug-2.9.7-7.4-vc15-x86_64.dll"
xdebug.profiler_output_dir = "C:\MEDIA\INTERNET\WAMP\Apache\logs"
xdebug.profiler_append = On
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = "callgrind.%R-%u.trace"
xdebug.trace_options = 1
xdebug.collect_params = 4
xdebug.collect_return = 1
xdebug.collect_vars = 0
xdebug.profiler_enable=0
xdebug.trace_output_dir = "C:\MEDIA\INTERNET\WAMP\Apache\logs"
html_errors = 0
If installed correctly you should be able to simply append ?XDEBUG_PROFILE to the end of a URL (from your local server). The files will be output to whatever you set for xdebug.profiler_output_dir (use quotes if there are spaces in your local file system's path).
To open the generated logs I recommend using QCacheGrind.
If you get stuck leave a comment. It appears that you're likely having trouble concentrating because the vast majority of the instructions are very easy to access. Additionally you should make an attempt to find search the web before asking questions that are easy to find by...searching the web. Good luck.

XDEBUG 2.3.3 not showing in phpinfo() no matter what (XAMPP 1.8.2 PHP 5.4.31 )

I've read every post out there (I think), and after 2 days hunting this I am still stuck. The goal is to use xDebug with Eclipse, but I cannot get past loading xDebug in the first place.
I am using XAMPP 1.8.2 with PHP 5.4.31, and per XDEBUG analyzer (below) downloaded the file suggested.
Tailored Installation Instructions
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: yes - Compiler: MS VC9 - Architecture: x86
Zend Server: no
PHP Version: 5.4.31
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\Windows
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
Instructions
Download php_xdebug-2.3.3-5.4-vc9.dll
Move the downloaded file to C:\xampp\php\ext
Edit C:\xampp\php\php.ini and add the line
zend_extension = C:\xampp\php\ext\php_xdebug-2.3.3-5.4-vc9.dll
Restart the webserver
I have edited php.ini in my XAMPP (located in C:\xampp) with the following:
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.3.3-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9001
I see no errors in any logs for my Apache server. What am I missing?

xdebug issue with IIS and php 5.2

I have searched for this question so far no success...
I am using php 5.2 (IDE:netbean) with IIS 8 as web server. I installed php_xdebug-2.2.2-5.2-vc9-nts xdebug.
Here is my php.ini changes:
zend_extension="C:\php\php_xdebug-2.2.2-5.2-vc9-nts.dll"
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.idekey="netbeans-xdebug"
then I restarted IIS; but when I copy paste html of phpinfo() in xdebug wizard I got below:
Summary
Xdebug installed: no
Server API: CGI/FastCGI
Windows: yes - Compiler: MS VC9 - Architecture: x86
Zend Server: no
PHP Version: 5.2.17
Zend API nr: 220060519
PHP API nr: 20060613
Debug Build: no
Thread Safe Build: no
Configuration File Path: C:\WINDOWS
Configuration File: C:\PHP\php.ini
Extensions directory: .
Instructions
Download
Move the downloaded file to .
Edit C:\PHP\php.ini and add the line
zend_extension = .\
Restart the webserver
it seems that xdebug was not installed successfully. any idea?

How do I set up PHP-debugging on Ubuntu 12.04 with Eclipse and XAMPP?

I've been trying to configure this for quite some time now but I can't get it running properly. Done so far:
Downloaded the latest version of xampp and moved it to /opt/lampp
Installed php5-xdebug with apt-get
Changed implicit_flush to On in /opt/lampp/etc/php.ini
Added the following lines to the end of the ini file:
[xdebug]
zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000
xdebug.remote_host="localhost"
I've made sure to restart apache, but I still don't get an xdebug-section when showing phpinfo();
I think that Eclipse is configured properly, but I can't know for sure until I get xdebug to run.
Please help, all suggestions are very welcome!
Edit:
Here is the output of phpinfo(): http://www.pasteall.org/35930
Update:
I've downloaded Xampp 1.8.1 (I had previously xampp 1.8.0) to /opt/lampp and added the appropriate development files. I have both compiled Xdebug myself according to the guide at http://xdebug.org/wizard.php and installed xdebug through /opt/lampp/bin/pecl.
Now my php.ini looks like this:
zend_extension = "/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
I don't know what to do, http://xdebug.org/wizard.php still reports that Xdebug isn't installed. Could it be a permission issue? Currently the permissions for the extensions are as follows:
-rwxr-xr-x 1 niklas niklas 88376 Sep 30 10:43 interbase.so
-rwxr-xr-x 1 niklas niklas 184920 Sep 30 10:43 oci8.so
-rwxr-xr-x 1 niklas niklas 118592 Sep 30 10:43 pgsql.so
-rwxr-xr-x 1 niklas niklas 830886 Oct 10 15:10 xdebug.so
Should they be owned by someone else? Must I enable any additional options in php.ini? This is my current output of phpinfo(): http://www.pasteall.org/36135
Tailored Installation Instructions
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.4.4
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: no
Configuration File Path: /opt/lampp/etc
Configuration File: /opt/lampp/etc/php.ini
Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525
Instructions
Download xdebug-2.2.1.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.2.1.tgzRun: cd xdebug-2.2.1
Run: phpize
As part of its output it should show:Configuring for:
...
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
If it does not, you are using the wrong phpize. Please follow
this FAQ entry and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525
Edit /opt/lampp/etc/php.ini and add the linezend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
Restart the webserver
http://xdebug.org/wizard.php
See below URL i think it is very help full to you
http://www.edmondscommerce.co.uk/ubuntu/ubuntu-xampp-xdebug-install/
http://www.webhelp2u.com/article/install-xdebug-on-lampp
https://stackoverflow.com/questions/9640912/problems-setting-up-eclipse-with-xdebug
Read it:-
Install XDebug on ( LAMPP OR XAMPP For Linux )
http://www.edmondscommerce.co.uk/ubuntu/ubuntu-xampp-xdebug-install/
http://www.webhelp2u.com/article/install-xdebug-on-lampp
To Install XDebug on LAMPP
Download the latest version of ( XAMPP For Linux ) From site http://www.apachefriends.org/en/xampp-linux.html
Install it. To install lampp, extract and put in /opt directory.
Download Development package from same site.
Extract it, copy and paste "include" folder from Development package to /opt/lampp directory. ( This package would use for compiling XDebug source )
Run command /opt/lampp/bin/pecl update-channels. this would update the pecl channels database at your local pc.
Run command /opt/lampp/bin/pecl install Xdebug. And wait for finishing the process.
Now xdebug.so file has been created in /opt/lampp/lib/php/extensions/ directory.
Now Open the file php.ini and add the line zend_extension="/opt/lampp/lib/php/extensions/path_to_xdebug.so". at the end of file.
Restart Lampp & Check enabled or not using phpinfo();
Update my answer after your comment
See below URL i think it is very help full to you.
Setup Xdebug for PHP5 in Ubuntu
http://gayanhewa.info/setup-xdebug-php5-ubuntu/
Since there is no sign of why it isn't working I've given up on xampp and just installed a regular lamp-server with xdebug through apt-get. I disabled mysql and apache2 from starting during boot so that they are not running if I don't want them. Here is a very simple tutorial on how to enable xdebug-debugging with Eclipse: http://www.web-brainz.co.uk/Xdebug
The other answers will surely be the most fitting for other users though they unfortunately didn't fix my issue. Thank you very much for help!
On a fresh ubuntu 12.04 run:
apt-get install php5-xdebug
Check for xdebug if it is installed:
php --version
it looks like this:
root#ubuntu-SandBox:/var/www# php --version
PHP 5.3.10-1ubuntu3.19 with Suhosin-Patch (cli) (built: Jul 2 2015 15:05:04)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
root#ubuntu-SandBox:/var/www#
Modify your php.ini to load Xdebug run:
vi /etc/php5/apache2/php.ini
and add at the bottom of the file:
[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000
/* this is the ip address of your PHPstorm IDE machine. */
xdebug.remote_host="10.70.111.11"
Restart your server:
service apache2 restart
Now your server is ready for your client IDE machine to connect.
Here is how to configure PHPSTORM:
Follow this instruction of JetBrain https://confluence.jetbrains.com/display/PhpStorm/Validating+Your+Debugging+Configuration
or
On menu Run => Web Server Debug Validation and you will see something like this:
If you dont get the yellow and everything is blue you are good!
Install chrome extension xdebug helper from here:
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
Start a debug session in browser by enable this extension by click on it and the bug icon turns green.
Then in IDE Run => Listening for php debug connections.
Set a breakpoint in the source code
Load your php page (webapp) and it will be stopped at breakpoints.
Done.

Install xdebug 2.1.4 on ubuntu server 5.3.6-13ubuntu3.6

I have tried to install xdebug on my ubuntu server machine and it's not working. The reason I know it's not working is that the output of var_dump is not colorized, nor can I connect to it using netbeans.
I followed the tailored instructions on how to install xdebug on
http://xdebug.org/wizard.php
Here is what the output of my phpinfo analysis was:
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.3.6-13
Zend API nr: 220090626
PHP API nr: 20090626
Debug Build: no
Thread Safe Build: no
Configuration File Path: /etc/php5/apache2
Configuration File: /etc/php5/apache2/php.ini
Extensions directory: /usr/lib/php5/20090626
The name of the file that wizard recommended was xdebug-2.1.4.tgz
The output of phpize was
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
My phpinfo now does show xdebug installed, here is how it looks like:
Here is what I have in my php.ini
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.profiler_output_dir = "/var/log/apache2/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%p"
xdebug.profiler_enable =1
xdebug.profiler_append=1
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_host=192.168.2.13
xdebug.remote_port=9000
;xdebug.idekey=xdebug
xdebug.idekey=netbeans-xdebug
xdebug.remote_connect_back=1
xdebug.remote_log="/var/log/apache2/xdebug_remote.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
The output of lsb_release -a on my computer is
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric
PHP version shown on phpinfo is 5.3.6-13ubuntu3.6
For the colours, you probably want to set html_errors=1 in php.ini as well.
As for the netbeans issue (you really should not combine issues in one question!), which IP addresses do your machine running PHP, and which IP address does your machine running netbeans have? The xdebug.remote_host setting should contain the IP address of the one running netbeans. The remote log file that you're generating should have connection attempts in it too.

Categories