Friday, February 18, 2011

part 4 / 13 : xdebug, php.ini and httpd.conf

Now, we have to get xdebug working.

php.ini
you'll find the file here:
windows: c:\xampp\php\php.ini
linux/mac: write a comment if you know, I'll update the post!

first of all make a copy of it.

Xampp integrate xdebug, so, there is no need to compile the version you need just change some lines in php.ini and it will run.

Open php.ini with the a text editor. The ";" are used to make comments, you have to remove it for thoses lines and modify the line if necessary like shown here:

;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
            =>  zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

;xdebug.remote_enable = 0               =>    xdebug.remote_enable = on
;xdebug.remote_handler = "dbgp"     =>     xdebug.remote_handler = "dbgp"
;xdebug.remote_host = "localhost"    =>     xdebug.remote_host = "localhost"
;xdebug.remote_port = 9000            =>     xdebug.remote_port = 9000

save the file, it's done! Xdebug should work.

httpd.conf
To get everythings working correctly I had to modify the httpd.conf but I'm not sure it's necessary for all the config.
My config: xampp 1.7.3 / w7 64bits
If I don't do this modification, the javascript debugger don't stop on the breakpoints

Anyway, it will not be a problem  if you do  this modifiction.

you'll find the file here:
windows: C:\xampp\apache\conf\httpd.conf
linux/mac: write a comment if you know, I'll update the post!

make a copy of the file before to make the modifications.

find the line:
Listen 80







in the next line write:
Listen 85

For those who have windows7 64 bits and trying to use it with xampp1.7.4. I made it works but I had to remove the "Listen 80" line. And it was really unstable. In that case, if you want to access to your server, localhost/ will not work, you always have to specify the port: localhost:85.


Before to go, we'll verify that xdebug is configurated.
Open XAMPP control panel. If apache is running, stop it. Apache must be restart to take in account the new configuration.
Press start to run apache.

Press admin at the side of the start button. It should launch your default web browser with a page where you have to choose you language. If it's not working, open a browser and write : localhost/ has the address.

 You'll get a welcome page to XAMPP.

On the left side, press phpinfo().
And look for xdebug in the page, you should found this:

If not, verify the configuration you've done in the php.ini file.

We're done for this part. On next part we'll install eclipse PHP.

more about xdebug :
http://www.xdebug.org/docs/all_settings
here the tuto which I used to have xdebug work:
http://www.eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf

4 comments:

  1. In my ubuntu, php.ini is located at /opt/lampp/etc/php.ini
    Nevertheless, executing
    su
    updatedb
    locate php.ini
    path to the php.ini file will be shown.

    Regards.

    ReplyDelete
  2. mac os x : /Applications/XAMPP/etc/php.ini

    ReplyDelete