0

I'm running XDebug on Linux CentOS. I want to profile pages on a web app built with CodeIgniter, served by Apache.

XDebug is enabled in php.ini with the following settings:

zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/xdebug

Everything works fine when I trigger php scripts from the command line, and XDebug profile logs are written to /tmp/xdebug, as expected. When I load a url from the web app through the browser, XDebug does not create any profile log files.

Has anyone gotten XDebug to work with Codeigniter? From what I can tell, I should not have to trigger XDebug profiling via GET in the url because profiler_enable is turned on for all php scripts, although I've tried this and it doesn't seem to work either.

T. Brian Jones
  • 13,002
  • 25
  • 78
  • 117

2 Answers2

1

Apache needed to have write permissions on the /tmp/xdebug folder.

sudo chown -R apache:apache /tmp/xdebug

XDebug can profile Codeigniter page loads from a browser now.

Thanks @J. Bruni.

T. Brian Jones
  • 13,002
  • 25
  • 78
  • 117
0

It seems to me that the issue is not related to CodeIgniter... It seems you may have multiple php.ini files...

In my Ubuntu installation, I have several sub-directories inside /etc/php5 directory: cgi, cli, fpm, etc. Each one of these has a php.ini file inside it, which is specific to a single "mode".

In other words: PHP may have several different php.ini files... one for CLI (command-line), other for CGI, and so on...

Maybe the xdebug configuration lines you pasted above are not in the php.ini file used when you access PHP scripts from the browser. Maybe you added these lines to /etc/php5/cli/php.ini instead of /etc/php5/cgi/php.ini (or another... in my setup, it is /etc/php5/fpm/php.ini, because I use php-fpm)

J. Bruni
  • 20,322
  • 12
  • 75
  • 92
  • Just found at xdebug documentation. I think you should try this simple test: "Write a PHP page that calls 'phpinfo()' Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful!" – J. Bruni Feb 29 '12 at 06:15
  • Everything looks good when I do that. Xdebug is loading and all it's settings are outputted with phpinfo(). – T. Brian Jones Feb 29 '12 at 06:29
  • So, the problem is not with `php.ini`... have you tried `phpinfo()` inside a CodeIgniter controller? (Just to check if xdebug is still there...) – J. Bruni Feb 29 '12 at 07:05
  • A guy in Windows solved his problem changing the log file name: http://stackoverflow.com/questions/8076743/xdebug-profiler-does-not-working - Also, the web server Apache must have permission to write in the profiler_output_dir... – J. Bruni Feb 29 '12 at 07:11
  • apache needed write permissions. now it's profiling codeigniter page loads through the browser. damn. how many times will that be my problem. haha. thank you for your help. – T. Brian Jones Feb 29 '12 at 07:31