Monday, February 7, 2011

Eclipse Xdebug installation With XAMPP LINUX

Eclipse is a great open-source and free tool to manage your programming projects.

I have been using eclipse for my java and php projects. Xdebug is an awesome debugging tool you can use with eclipse to debug your php code.

I assume you are using xampp linux and you have set the server at /opt/lampp location.

Requiremnts:
eclipse classic/eclipse for php developers installation 3.6.1.

At first we shall install xdebug as an extension of php
1. Download the source code from http://www.xdebug.org/
2.unzip the tar file and move in to the directory.

Now we will use the phpize utility in your /opt/lampp/bin/phpize location
if it shows error like "segmentation fault", Run in the terminal sudo apt-get install php-dev

Xdebug website has an amazing insturction page. check it here
http://www.xdebug.org/docs/install

Don't forget to check the following wizard:
http://www.xdebug.org/find-binary.php

 After following the instruction you will have installed xdebug which you can check by the phpinfo();

Configuration at Eclipse:

Go to window>preferences>php

Set you php executable path first (e.g. /opt/lampp/bin/php)
Then configure the debug section. Select the php debugger as Xdebug.

You are almost done!

*********
Now Go to Run>Debug configuration
make sure you have selected xdebug. Now you're ready to bite the bugs .Hope this helps. Enjoy!





Saturday, December 11, 2010

Bohemian words

Learning the zend framework. First difficulty was connecting to database. Found the solution by editing the mysql configuration file my.cnf located in the /path/to/lampp/etc/my.cnf
If you face this problem comment the skip-networking line.

I'm working on http://www.corporatekeys.com.au/blog/ website now.

I didn't know that Drupal doesn't follow the object oriented paradigm!

Trying to write a post on wordpress codeflow.

Tuesday, July 13, 2010

Find your Flickr ID

I was trying to learn the flickr api.I found that I don't know my flickr ID! so I have made a small script that can help everyone finding FLICKR ID.

FIND YOUR ID HERE



I used the flickr api to fetch the ID.

Sunday, July 4, 2010

hit-moviez.co.cc wordpress posts automated

http://hit-moviez.co.cc
I had beeen plannig to write a script that can publish posts automatically in wordpress from different sites. It took me two days to write the script. currently it takes movie information from IMDB and publishes automatically.
Only best 5 movies are published now.It publishes the images,title,poster,review etc.categoris users are automatically created.planning to convert it to a wordpress plugin.

Sunday, April 25, 2010

PHP Listing all files in a folder and sub-folders

I was trying to write a php code that lists all files in a folder and sub folders tree.
At first I wrote this one
function printAll($dirName)
{
$handle=opendir($dirName);
while($file=readdir($handle)){
if(is_file($file)){
echo $file;
}
else if(is_dir($file)&&$file!='.' && $file!='..')//for excluding . and .. 
{
$dirName=$dirName.'/'.$file;
chdir($dirName);
printAll($dirName);
}//elseif
}
}
printAll(getcwd());//calling the function 

But it will list only the deepest files in the first subfolder tree.SO I searched php.net and got the solution. all the subfolder will be kept in a array and will be searched recursively. Here is the code
function printAll($dirName)
{
$dirs=array($dirName);
$files=array();
while($dir=array_pop($dirs)){
$handle=opendir($dir);
while($file=readdir($handle)){
if($file!='.' && $file!='..'){
$dest=$dir.'/'.$file;
if(is_file($dest)){
$files[]=$file;
echo $file;
}
else{
$dirs[]=$dest;
}
}
}//end of 1st while
}//end of 2nd while

return $files;
}//end of function

printAll(getcwd());
The function now returns a array containing the name all files in the current folder and subfolders tree.It will print all the file names too. you can easily modify this.
That's it! It was fun.If any function is unknown to you just visit php.net.

About Me

Web Developer From Dhaka, Bangladesh.