HowtoForge

Installing PHP5 Debugger On OpenSUSE 11.3

Installing PHP5 Debugger On OpenSUSE 11.3

This tutorial shows how to install php5 debugger (xdebug) on OpenSUSE 11.3.

I suppose you have installed Apache2 and PHP5 packages through zypper or yast. If not, please run:

zypper install php5 apache2 apache2-mod_php5

The reason I use xdebug is, as far as I know now, xdebug supports php 5.3 or above.

I have the following installation environment:

OS: OpenSUSE 11.3 32 bit

Webserver: Apache 2.2.15 linux/suse

PHP: 5.3.2, with xdebug 2.1.0

Now let's begin (I run the following step as root, although you may not need it for some steps).

Step 1. Download xdebug 2.1.0 from http://www.xdebug.org/files/xdebug-2.1.0.tgz into /tmp directory, run tar command to unzip it, and cd into the xdebug2.1.0 directory:

cd /tmp
tar zxvf xdebug-2.1.0.tgz && cd xdebug-2.1.0

Step 2. Install additional packages before compiling xdebug, for my system, I need gcc, make, and php5-devel:

zypper install gcc make php5-devel

Step 3.  Make sure /usr/bin/phpize and /usr/bin/php-config exist (soft links to /etc/alternative/):

ls -l /usr/bin/php*

Step 4. Please read the README file, installation procedure is clearly explained.

Step 5. Run the phpize command:

phpize

You should see the following message on your screen:

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

Step 6.  Now compile xdebug:

./configure --enable-xdebug && make

If everything is ok, you should see that output on the screen, like:

libraries have been installed in: /tmp/xdebug-2.1.0/modules
build complete

Step 7. Find where the php5 modules are, and copy the xdebug.somodule to that directory. Since I installed php5, apache2 through zypper, the php5 module directory is under /usr/lib/php5/extensions/:

cp modules/xdebug.so /usr/lib/php5/extensions/

Step 8. Find where the php.ini configuration file is. Again if you install php5 and apache2 through yast or zypper, it is under the /etc/php5/apache2/ directory.

vi /etc/php5/apache2/php.ini

Add the following line at the end of this configration file:

zend_extension="/usr/lib/php5/extension/xdebug.so"

Step 9. Restart apache server, if there are no error messages, everything should work now.

/etc/init.d/apache2 restart

Step 10. Write a php page with a single line phpinfo();, load it in a browser, and you should see the following message:

 This program make use of the zend scripting language engine:
Zend engine v2.3.0 copyright (c) 1998-2010 zend technologies
  with Xdebug v2.1.0. Copyright(c) 2002-2010, by Derick Rethans

You should also find an xdebug section near the end of this page. Bingo!

Please let me know if you have any question. Thanks.

Installing PHP5 Debugger On OpenSUSE 11.3