Configuring php.ini

Using Notepad++, open 'C:\wamp\bin\apache\Apache2.2.11\bin\php.ini'.  

Did I say 'C:\wamp\bin\php\php5.2.8\php.ini'?  No!  Perish the thought.  If you played with the menu on the system tray for WampServer and saw a cute little menu that says something like "I am the php.ini file, edit me" then you fell for the sucker routine hook line and sinker.  Time to cut your losses and come to grips with the fact that there are more than one php.ini files floating around and that you will always have to make sure you are playing with the relevant file.  How to do this?  Well, for one, listen to me.  The relevant php.ini file here is 'C:\wamp\bin\apache\Apache2.2.11\bin\php.ini'.  Got that?  But what if I'm on a desert island and I've only got my laptop and I just can't listen to you?  Well, in that case you get a hold of your browser, go to localhost/phpinfo.php and hit it.  Look for the entry that spells out exactly what your 'Loaded Configuration File' is.  What?  You don't have a phpinfo.php residing on your document root?  Plagiarize my (ok, somebody else's) three lines of code from here.

You should find the following text in your relevant php.ini file after you have extracted your Drupal files to c:\wamp\www.

Using Notepad++'s convenient line numbers, we will make changes to the following lines in this file:
  • 304
  • 434
  • 542
  • 600
  • 1043
  • 1335 
304:

Change 'max_execution_time = 30' to 'max_execution_time = 180'.  The reason for this change is to allow your Drupal environment a bit more time to do its thing while PHP code is being thrashed about.  On some hardware, like my laptop, this time extension is critically necessary when Drupal initially populates its MySQL tables.

434:

If not automatically set by your WampServer installation, make sure this line reads 'error_log = c:/wamp/logs/php_error.log'.  No need for the quote marks used here.

542:

Make sure this line reads 'extension_dir = "c:/wamp/bin/php/php5.2.8/ext/"'.  Delete the outer quote marks, of course.

600:

This should read as 'upload_tmp_dir = "c:/wamp/tmp"'.  Again, get rid of the outer quote marks.

1043:

Make sure this is set as: 'session.save_path = "c:/wamp/tmp"'.  Once more, don't use the outer quote marks.

1335:

This is where we add the settings that allow xdebug to work in your PHP environment.

The following code should work:

[xdebug]
zend_extension_ts="C:\wamp\bin\php\php5.2.8\ext\php_xdebug-2.0.4-5.2.8.dll"
xdebug.profiler_output_dir = "c:\wamp\tmp\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=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_log="c:\wamp\tmp\xdebug\xdebug_remote.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0


Now that you've done all this configuration work, how can you test to see if xdebug is properly working now in your WampServer?  It's easy.  Go to your system tray WampServer menu.  Click on the first option, 'Localhost'.  If you put the phpinfo.php file where I told you to, it should be listed under 'Tools' after your browser fires up the localhost index page.  Click on this tool and see if you can find this entry:


If the line 'with Xdebug v2.0.4, Copyright (c) 2002-2008, by Derick Rethans' is being displayed, then we are good to go to Step 4, which is (finally!) setting up a debuggable Drupal project on PDT Eclipse.  If this line is not being displayed, then you'll just have to go back to the drawing board, or share your comments with us in the comment section below.

By the way, the particular settings for your Xdebug configuration should be displayed in a box that looks (partially) like this:


Your signposts may vary if you are using different versions of whatever or Xampp or something else entirely.  

Remember to always make sure you are editing the relevant php.ini file.  The relevant php.ini file is the one that is listed as the 'Loaded Configuration File' when phpinfo() is called.




About Kipp Elliott Watson

Kipp Elliott Watson is a Drupaler (Drupalista?) who lives in Northern New Jersey and subscribes enthusiastically to the principles that have helped broaden Drupal's community and have brought Drupal to the forefront of the CMS revolution.  He is occasionally available for Drupal projects and would love to hear from you if you need a Drupal consultant.  His resume can be viewed and downloaded here.  

If you would like to learn about the Ideal Drupal Development Environment, visit: http://sites.google.com/site/theidealdrupalenvironment/

If you would like to add a Google Wave to a fresh Drupal installation, visit:

Drupal Developer for Hire

Looking to hire a Drupal Developer? Email me at Kipp period Watson at gmail period com. Just mention this website, so I'll know where you're coming from!