Configuring Xdebug,Eclipse PDT,Xampp in Linux


After a large battle in figuring out the debugging of a PHP Application.We have come with a solution.

Here whats the step we have followed.

Step 1:

Download the EclipsePDT.

Step 2:

Download the XAMPP Server for linux and download its corresponding development version too.

Download the Xdebug Source.

Step 3:
Once all have done,extract XAMPP package to /opt by using the ‘Terminal’.

ckuser@ckuser-desktop:~$ sudo tar xvzf xampp1.7.2.tar.gz -C /opt

It will take a minute to extract all your files.

Once its done.Start the server by the command.

ckuser@ckuser-desktop:~$ sudo /opt/lampp/lampp start.

You should see the xampp server page is up in the browser and click on the ‘phpinfo’ on the left hand side of the xampp screen.

You will see the PHP Version and Location of your ‘php.ini’ file.

Make a note of that.It will need for a future use.

Step 4:
Then stop the server,

ckuser@ckuser-desktop:~$ sudo /opt/lampp/lampp stop.

Now give the permission to /opt/lampp to extract the package directly.

ckuser@ckuser-desktop:~$ sudo chmod -R 777 /opt/lampp

Now open the devlopment package of xampp,in that you will see ‘many directories like ‘build’,’include’ and so on.Select all that directories and extract to /opt/lampp.

Once its done,

Now open the Xdebug package,extract to /opt/lampp/bin.

Give full permission to Xdebug folder.

ckuser@ckuser-desktop:~$ sudo chmod -R 777 /opt/lampp/bin/name of the xdebug directory.

Now change the permission to /opt/lampp

ckuser@ckuser-desktop:~$ sudo chmod -R 755 /opt/lampp

And then create a workspace directory in root directory of xampp.

ckuser@ckuser-desktop:~$ sudo mkdir /opt/lampp/htdocs/any name you wish.

Give full permission to the workspace directory.

Step 5:

Start the server again.

ckuser@ckuser-desktop:~$ sudo /opt/lampp/lampp start.

Open your ‘php.ini’ file located in /opt/lampp/etc/php.ini

ckuser@ckuser-desktop:~$ sudo gedit /opt/lampp/etc/php.ini

it will open up in the ‘gedit’ file.

go to the last line of the ‘php.ini’ file,add the below code in that file.

[Zend Debug]
zend_extension=/opt/lampp/bin/xdebug-2.0.5/modules/xdebug.so

xdebug.remote_enable=on

xdebug.remote_host=localhost

xdebug.remote_port=9000

save and close the file.

For getting a xdebug.so compiled for your version of PHP.Follow these steps

ckuser@ckuser-desktop:~$ cd /opt/lampp/bin/xdebug-2.0.5
ckuser@ckuser-desktop:~$ sudo /opt/lampp/bin/phpize

it will come up the version then type the next command

ckuser@ckuser-desktop:~$ ./configure --with-php-config=/opt/lampp/bin/php-config

Then ‘make’ the ‘so’ file.

for that,

ckuser@ckuser-desktop:~$ sudo make

then for ‘testing the ‘so’ file.

ckuser@ckuser-desktop:~$ sudo make test

it should come up with a message ‘Build Completed’.

Now if you navigate to the xdebug–>modules directory, you will find the ‘xdebug.so’ file.

Now restart the server

ckuser@ckuser-desktop:~$ sudo /opt/lampp/lampp restart

Thats all will done.

Configure the rest of part in eclipse,it will work fine.

Thanks for all my friends and my special one.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s