Dec 23

A Comprehensive Guide To Run Yii Framework On XAMPP In Linux

Yii is professional PHP framework best for developing Web 2.0 applications. This guide elaborates on how to set up the Yii framework in XAMPP under a Linux environment.

First you need to download and install XAMPP as indicated in the XAMPP guide in Then you need to get write permissions to the /opt/lampp/htdocs folder (where all the websites will be stored). First look at who is owning /opt/lampp/htdocs .

ls -ld /opt/lampp/htdocs

This should return something like

drwxr-xr-x. 5 root root 4096 Dec 22 22:55 /opt/lampp/htdocs

drwxr-xr-x. denotes the file permissions of the folder. The part root root specifies the owner of the directory and the owning group of the directory. Let’s first change the owning group of the folder. Let’s create a group called www and change the group ownership of the folder to www.

sudo groupadd www
sudo chgrp -R www /opt/lampp/htdocs

Now a ls -ld should return something like the following

drwxr-xr-x. 5 root www 4096 Dec 22 22:55 /opt/lampp/htdocs

Now the XAMPP server should be configured to run using the group www. Open the /opt/lampp/etc/httpd.conf file.

sudo vim /opt/lampp/etc/httpd.conf

Then find the entry,

User daemon
Group daemon

(yours might be slightly different). Change the User entry to your user name and Group entry to www. Now you need to set the permissions of the /opt/lampp/htdocs folder.

sudo chmod 2775 /opt/lampp/htdocs
usermod -aG www

You’ll need to logout and log in to the system since group memberships are read at login time. But before doing that, let’s carry out another task that will require a logout. We need to add PHP to our PATH. So open your .bashrc as follows.

vim /home/.bashrc

Then add the following lines to the end of that file.

##Adds XAMPP bin to PATH
export PATH=/opt/lampp/bin:$PATH

Now logout and login. Then extract the Yii framework to a folder named yii in the /opt/lampp/htdocs folder, start the XAMPP server and go to the address http://localhost/yii/requirements/index.php to check whether Yii is working. Then to create a Yii application, follow the following commands. I have used the test name blog.

cd /opt/lampp/htdocs/
php ./yii/framework/yiic webapp blog

After completing the creation, visit http://localhost/blog/ to verify the functionality of the created Yii application…!.

References :

Share Button
Jun 08

How to install zeromq (0MQ) in Ubuntu with Java bindings

I tested this in Ubuntu 13.04, but essentially this should work in any Ubuntu distribution. First install the libtool, autoconf, automake, uuid-dev, e2fsprogs packages.

sudo apt-get install libtool autoconf automake uuid-dev e2fsprogs

Then clone the 0mq source using,

git clone git://

Then go in to the libzmq directory and run the following commands in order.

sudo make install
ldconfig -v

Then run the following command and check the output.

ls -al /usr/local/lib/libzmq.*

The output should be similar to,

-rw-r--r-- 1 root root 7082022 ජූනි 7 14:16 /usr/local/lib/libzmq.a
-rwxr-xr-x 1 root root 947 ජූනි 7 14:16 /usr/local/lib/
lrwxrwxrwx 1 root root 15 ජූනි 7 14:16 /usr/local/lib/ ->
lrwxrwxrwx 1 root root 15 ජූනි 7 14:16 /usr/local/lib/ ->
-rwxr-xr-x 1 root root 2876918 ජූනි 7 14:16 /usr/local/lib/

Now you should install the Java bindings for 0mq (in order to use omq from Java of course!). First check whether the JAVA_HOME environment variable is correctly set using,


This should output the location that you have installed Java. If it’s giving an empty output, then set it manually using

export JAVA_HOME=/location/to/your/java/installation

In my case the command is,

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_17

Then clone the java bindings for 0mq using,

git clone

now go inside the jzmq folder. Now same as before, run the following commands in order.

sudo make install

Now run the following command to verify the installation.

ls -al /usr/local/lib/*jzmq* /usr/local/share/java/*zmq*

The output should be like the following.

-rw-r--r-- 1 root root 535266 ජූනි 7 14:40 /usr/local/lib/libjzmq.a
-rwxr-xr-x 1 root root 998 ජූනි 7 14:40 /usr/local/lib/
lrwxrwxrwx 1 root root 16 ජූනි 7 14:40 /usr/local/lib/ ->
lrwxrwxrwx 1 root root 16 ජූනි 7 14:40 /usr/local/lib/ ->
-rwxr-xr-x 1 root root 242784 ජූනි 7 14:40 /usr/local/lib/
-rw-r--r-- 1 root root 40618 ජූනි 7 14:40 /usr/local/share/java/zmq.jar

Notice the last line, that’s the newly created jar that connects to 0mq. Now you can use 0mq inside a Java programme.


If you get any of the following errors (which I got) when building the jar, export the mentioned system variables in the terminal to resolve them.


checking for javah… no

configure: error: cannot find javah


export JAVAH=/location/to/your/java/installation/bin/javah

ex – export JAVAH=/usr/lib/jvm/jdk1.7.0_17/bin/javah


checking for jar… no

configure: error: cannot find jar


export JAR=/location/to/your/java/installation/bin/jar

ex – export JAR=/usr/lib/jvm/jdk1.7.0_17/bin/jar

(Most of the content of this guide is based up on )

Share Button
Jun 10

Adding a template for new Python files in Emacs

I wanted my name and email address to appear in the top of the page every time I create a new python file in Emacs. So here’s what I did to achieve that.

First of all create a folder called templates in the .emacs.d directory (the .emacs.d directory is located in your home directory. If it does not exist, just create the directory ). Then create a file named  in that directory. And add the text you want to be included when you create a new python file. An example can be shown as follows.

#Name: This Is My Name


Then open the .emacs file in your home directory (if this doesn’t exist, simply create an empty file named .emacs). Then add the following content to the bottom of the .emcas.

;To load python templates

(add-hook 'find-file-hooks 'maybe-load-template)
(defun maybe-load-template ()
(when (and
(string-match "\\.py$" (buffer-file-name))
(eq 1 (point-max)))
(insert-file "~/.emacs.d/templates/")))

That’s all…!. Now when ever you create a new python file using Emacs these header info will appear!.

More info:

As you might have observed this trick can be extended to other file types by changing the .py extension in the (insert-file “~/.emacs.d/templates/”) line and creating a relevant template in the templates folder.

Also there are more advanced ways to achieve the same with more functionality in

Share Button