0

I am trying to install Xdebug on remote server in AWS cloud for profiling purpose. I installed Xdebug i checked using phpinfo() and i kept some setting to enable profiling option on server, it's enabled i verified.

I am saving the output logs of pro filer in a directory on remote server. Now i want to open those files using Kcachedgrind. So i installed Kcachesgrind.

The settings which i used in PHP.ini file are below.

zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.profiler_output_dir = "/opt/lampp/htdocs/profiler/logs"
xdebug.profile_output_name = cachegrind.out.%t-%s
xdebug.remote_enable=On
xdebug.remote_host="ip-10-125-11-57"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.show_local_vars=On
xdebug.collect_return=On
xdebug.collect_params=4
xdebug.profiler_enable=On
xdebug.profiler_enable_trigger=1

In the above settings you can see filed called xdebug.remote_host normally it is localhost but i am in remote server so i kept host name of my server there. I am getting an below error when i tried to open the file using Kcachegrind.

Kcachegrind: Can't connect to X server
Charles
  • 50,943
  • 13
  • 104
  • 142
Venkata Krishna
  • 4,287
  • 6
  • 30
  • 53

2 Answers2

2

You basically have two sane options:

  1. Download the file from the remote server to your local computer and debug them there. If you are annoyed by having to download the file each time, automate the task somehow.

  2. Use a command-line utility for evaluating the file (The xdebug documentation mentions ct_annotate), see here: http://xdebug.org/docs/profiler

I'd strongly suggest option 1.

Be advised, that Kcachegrind is a program with a GUI (Graphical User Interface), meaning: It has windows and buttons and stuff like that. Your remote server usually does not need any GUI software, therefore there is no support for windows and buttons and stuff like that installed (no X server, no KDE, etc...). While TeTeT solution is theoretically possible, please do NOT install X on your remote server and connect via vnc. It is slow, it will use up lots of hard disk space and memory and is a steep learning curve for beginners.

BRoeser
  • 21
  • 2
0

If you really want to debug that on the server, you will need to install X and a desktop for it and connect via vnc.

Maybe it would also work to copy the debug and profile files to a local system and inspect them there.

TeTeT
  • 2,044
  • 20
  • 30