Installing PHP5 Debugger On OpenSUSE 11.3

Want to support HowtoForge? Become a subscriber!
 
Submitted by wintel2006 (Contact Author) (Forums) on Mon, 2010-09-13 19:16. :: SuSE | Apache | PHP

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.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by kajal (not registered) on Wed, 2010-10-20 07:56.
Thanks for this great tips... I did the same installation procedure in opensuse11.1 with php5.2 . I have netbeans installed and  xdebug is working good. Thanks.
Submitted by Anonymous (not registered) on Tue, 2010-10-19 19:47.

Alternatively you can install xdebug from the openSUSE repositories to avoid having to build it yourself, and to allow updating it when a new version is available.

1. Add the PHP extensions repo

zypper ar http://download.opensuse.org/repositories/server:/php:/extensions/openSUSE_11.3/ PHP_extensions

2. Refresh the repo cache, and accept the repo signing key

zypper ref

3. Install xdebug

zypper in php5-xdebug

Submitted by Luis Dillon (not registered) on Tue, 2010-11-09 09:08.

You might need to install autoconf in case you get this error message when you run phpize:

PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

To install it just  "zypper install autoconf"