T. Brian Jones
T. Brian Jones

Reputation: 13532

How do I profile a Codeigniter Web App with XDebug?

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.

Upvotes: 0

Views: 1062

Answers (2)

T. Brian Jones
T. Brian Jones

Reputation: 13532

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.

Upvotes: 1

J. Bruni
J. Bruni

Reputation: 20492

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)

Upvotes: 0

Related Questions