Install PhpUnit

March 7, 2014 Leave a comment

Run the Windows Command Processor (cmd.exe).
Run >pear channel-discover
Run >pear remote-list -c phpunit
You will see a similar screen:
DbUnit 1.3.0
Diff 1.1.0
Exporter 1.0.0
File_Iterator 1.3.4
FinderFacade 1.1.0
Git 1.2.0
PHPUnit 4.0.1
PHPUnit_MockObject 1.2.3
PHPUnit_Selenium 1.3.3
PHPUnit_SkeletonGenerator 1.2.1
PHPUnit_Story 1.0.2
PHPUnit_TestListener_DBUS 1.0.0
PHPUnit_TestListener_XHProf 1.0.0
PHPUnit_TicketListener_Fogbugz 1.0.0
PHPUnit_TicketListener_GitHub 1.0.0
PHPUnit_TicketListener_GoogleCode 1.0.0
PHPUnit_TicketListener_Trac 1.0.0
PHP_CodeBrowser 1.0.2
PHP_CodeCoverage 1.2.16
PHP_Invoker 1.1.3
PHP_Timer 1.0.5
PHP_TokenStream 1.2.2
Text_Template 1.2.0
Version 1.0.2
bytekit 1.1.3
phpcov 1.1.0
phpcpd 2.0.0
phpdcd -n/a-
phploc 2.0.4
test_helpers 1.1.0
Run >pear install phpunit/PHPUnit-4.0.1
You will see a similar screen:
downloading PHPUnit-4.0.1.tgz …
Starting to download PHPUnit-4.0.1.tgz (510,701 bytes)
….done: 510,701 bytes
install ok: channel://

Install PHP Mess Detector

March 7, 2014 Leave a comment

Run the Windows Command Processor (cmd.exe).
Run >pear channel-discover
Run >pear channel-discover
Run >pear install phpmd/PHP_PMD-1.5.0. You will see a similar screen:

Did not download optional dependencies: pecl/imagick, use –alldeps to download
pdepend/PHP_Depend can optionally use package “pecl/imagick” (version >= 2.2.0b2
downloading PHP_PMD-1.5.0.tgz …
Starting to download PHP_PMD-1.5.0.tgz (49,534 bytes)
………….done: 49,534 bytes
downloading PHP_Depend-1.1.4.tgz …
Starting to download PHP_Depend-1.1.4.tgz (179,584 bytes)
…done: 179,584 bytes
install ok: channel://
install ok: channel://

Install PEAR on windows

February 28, 2014 Leave a comment

Follow these steps-

  1. Get the file on the link ->
  2. Go to this directory C:\wamp\bin\php\php5.3.13. Put go-pear.phar her.
  3. Open command prompt (cmd.exe). Supposing you’re using Windows, press Start, type “cmd.exe” and right click on it and select run as administrator.
  4. Type this cd “C:\wamp\bin\php\php5.3.13″ Press Enter. You should note that instead of saying “C:\system\32″ is now displaying C:\wamp\bin\php\php5.3.13
  5. Write the following command and press Enter: php -d phar.require_hash=0 go-pear.phar
  6. Select whether you like or not a local copy or a system one. By typing system:local and pressing enter you’ll install a local copy. By typing system and pressing enter you’ll install a system-wide copy.
  7. Type yes to confirm the option chosen. The next list of directories, will be the referring directories that PEAR will install its components. If you select from 1 – 12 you can change the directory you’d like to install.

Joomla 3.x component creator

August 16, 2013 Leave a comment

Create Component Joomla 3.x

How to install xampp/lampp on centos (linux)

June 27, 2013 Leave a comment

How to install xampp/lampp on centos (linux)

The installation procedure here is based on CentOS 6.x workstation default installation. Follow these steps
1. Log in linux terminal

2. Change user to root. Write below command and press enter and enter root user password.


3. The default installation of CentOS lacks some of the libraries that XAMPP needs to run, including 32 bit compatibility libraries.
To get them you su to root then use this yum command.

#yum -y install glibc* libstd*

4. Download and install the latest verions from the XAMPP, from the XAMPP download page. Upload this file to server /opt/ directory.

5. Unpack tar file

#tar zxvf xampp-linux-1.8.1.tar.gz /opt/

6. Change the ownership of all the xampp files to be nobody:root.

#chown nobody:root /opt/lampp/ -R

7. XAMPP was designed to run on 32 bit operating systems. The start up script will prevent xampp from starting up if you are running on a 64 bit system which isn’t necessary since you installed 32 bit compatibility libraries in step 1. To get around this restriction, open /opt/lampp/lampp in an editor and comment out the following lines.

# XAMPP is currently 32 bit only
#case `uname -m` in
# *_64)
# if /opt/lampp/bin/php -v > /dev/null 2>&1
# then
# :
# else
# $de && echo “XAMPP gibt es zur Zeit nur als 32-Bit Applikation.
# Bitte verwende eine 32-Bit Kompatibilitaetsbibliothek fuer Dein
# System.”
# $de || echo “XAMPP is currently only availably as 32 bit
# application. Please use a 32 bit compatibility library for
# your system.”
# exit
# fi
# ;;

8. Open /opt/lampp/etc/etc/extra/httpd-xampp.conf in an editor. Replace the “Deny from all” statement with “Require all grant” in the stanza. You can also comment out the “Allow from…” line if you don’t want to accept connections from any external system.

Order deny, allow
# Deny from all
Require all granted
# Allow from ::1 \
# fc00::/7
# fe80::/10
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

9. Start up xampp
#/opt/lampp/lampp start

10. To fix most of the security weaknesses in xampp simply call the following command

#/opt/lampp/lampp security

It will ask you to change password. Set all pasword.

11. Open http://localhost in a browser. You should a get a browser window with the XAMPP for Linux startup screen.

12. Open /opt/lampp/lampp/phpmyadmin/ in your editor of choice

13. Change the authentication type as follows:

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’

14. Add the following lines in the file.

$cfg[‘Servers’][$i][‘table_uiprefs’] = ‘pma_table_uiprefs';
$cfg[‘Servers’][$i][‘recent’] = ‘pma_recent';

15. Close your browser then restart Apache and MySQL in the XAMPP Control Panel.

#/opt/lampp/lampp restart

17. At this point most of the setup work for XAMPP is done. However, if you plan to use phpyMyAdmin you’ll have to do a little further configuration to get it to work properly. XAMPP does not create all the tables that phpmyadmin needs so you have to do this with an SQL script that is enclosed with the package. To do this click on the Import tab in phpmyadmin. Choose the create_tables.sql script in /opt/lampp/lampp/phpmyadmin/examples directory and press go button.

18. If website is not open. Then check port 80 on centOs. dport port 80 by following command.

# sudo iptables -I INPUT -p tcp –dport 80 -j ACCEPT
# sudo service iptables save

19. For ftp dport 21 port

# sudo iptables -I INPUT -p tcp –dport 80 -j ACCEPT
# sudo service iptables save

20. [optional] Block brute force attack. Please read this

Follow me on facebook

Show data in multicolumns

April 18, 2013 1 comment

Sometimes we need to show data in multi columns. Here is the little script for this logic.
First we need data in array. Let’s create a array.
Sometimes we need to show data in multi columns. Here is the little script for this logic.
First we need data in array. Let’s create an array and display this data in two column.

$columns =2;//No of column
$dataToDisplay = array('green', 'blue', 'white', 'apple', 'computers', 'php');
echo "<table width='100%'>";
$columnwidth = 100/$columns;
$count = count($dataToDisplay);
$i =0;
foreach($dataToDisplay as $data) {
    if($i % $columns == 0){
        echo "<tr>";
    echo "<td>" . $data . "</td>";
    if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows){
        echo "</tr>";
echo "</table>";

Joomla and CodeSniffer

June 19, 2012 1 comment

Joomla provides custom coding standard for the PHP CodeSniffer, read more about CodeSniffer. Download Joomla coding standard from here Joomla coding standards for more information see here. Read Joomla coding standards here.


Get every new post delivered to your Inbox.

%d bloggers like this: