I suppose you have installed Xampp and MongoDB on your ubuntu

1 – Download Xampp Development Package

2 – Install Xampp Development Package(The development package contains all files you need if you want to compile other software packages for XAMPP by yourself and the Unix manual pages. Install this package like the normal XAMPP distribution) , Note :- replace xx with your version
$ sudo tar xvfz xampp-linux-devel-xx.xx.xx.tar.gz -C /opt

3 – I needed the proper libc includes for 32-bit builds. I’m running a 64-bit machine. So I just ran:
$ sudo apt-get install libc6-dev-i386

4 – Download Mongo Php Driver (Grab the source code from github)

5 –
$ tar zxvf mongodb-mongodb-php-driver-.tar.gz

$ cd mongodb-mongodb-php-driver-

$ sudo /opt/lampp/bin/phpize

$ ./configure

6 – Make changes to the Makefile (XAMPP requires a 32-bit compilation)
– Choose your favorite text editor and open “Makefile”
– Make the following changes:
Line 20: prefix = /opt/lampp
Line 23: prefix = /opt/lampp
Line 25: phpincludedir = /opt/lampp/include/php
Line 27: CFLAGS = -g -O2 -m32
Line 34: EXTENSION_DIR = /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/
Line 35: PHP_EXECUTABLE = /opt/lampp/bin/php

Make sure you replace
Line 38: INCLUDES = -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib -I/util -I/exceptions -I/gridfs -I/types -I/mcon

7 –
$ sudo make all

8 – note :- remove xxxxxx with date on your folder under dir /opt/lampp/lib/php/extensions/
$ sudo cp modules/ /opt/lampp/lib/php/extensions/no-debug-non-zts-xxxxxx/

9 – Update your php.ini file
– Grab you favorite text editor and open /opt/lampp/etc/php.ini (you’ll probably need to use sudo).
– Add the line:

10 – restart your xampp and go


Nodejs on Ubuntu 12.04

How To Install Nodejs on Ubuntu 12.04

run an apt-get update before starting to install

sudo apt-get update

install a compiler

sudo apt-get install build-essential

install curl if not exist

sudo apt-get install curl

changing the path to include commands from the ~/local/bin directory. | by execute next command

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc

sourcing the .bashrc file

. ~/.bashrc

Create directory for the installation

cd ~
mkdir local/node
cd local/node

Run curl to get the node.js

curl | tar xz --strip-components=1

limiting installation to the local user.

./configure --prefix=~/local

install node

make install

downloading the the node package manager

curl -L | sh

Note that :-
“php” => “/opt/lampp/bin/php”
“php composer.phar install” should be
“/opt/lampp/bin/php composer.phar install”

so I will create bash alias
on command line (without $)
$ gedit ~/.bashrc
* append these line to file
alias xphp=’/opt/lampp/bin/php’
* save file
on command line (without $)
$ . ~/.bashrc
* now you can use “xphp composer.phar”

1 – move to your project dir

2 – download composer file
curl -s | xphp

3 – install Composer
xphp composer.phar install


create link to php with

sudo ln -s /opt/lampp/bin/php /usr/local/bin/php

export SSL_CERT_DIR=/etc/ssl/certs

Then go through normal steps

$ curl -sS | php
$ sudo mv composer.phar /usr/local/bin/composer
$ composer create-project symfony/framework-standard-edition path/

run this command via console

sudo apt-get install libasound2-plugins:i386

This is a step by step HOWTO to host git repositories using gitosis on a Centos 5.2 box.

Step 1 – (On your server)
Install python-setuptools on your server, you’ll need it to install gitosis.
As root:
yum -y install python-setuptools

Step 2 – (On your server)
Install git. You’ll need the DAG RPM repository for this one.
As root:
– Red Hat Enterprise Linux 5 / i386:
rpm -Uhv
– Red Hat Enterprise Linux 5 / x86_64:
rpm -Uhv

yum -y install git

Step 3 – (On your server)
Install gitosis.
As root:
git clone git://
(it should download stuff and create a gitosis directory)
cd gitosis
python install

Step 4 – (On your server)
Make a user called git.
adduser git
Give your new user git a password.
passwd git

Step 5 – (On your client)
The whole point of gitosis is to transfer files via ssh using a shared key process (ie: no password required to login to user git on your server). Now before you go and start doing it the manual way – don’t. Gitosis must create and maintain the authorized_keys file.

As your normal user on your client/development box:
ssh-keygen -t rsa (take the defaults)

There is now a new file called in ~/.ssh/

Copy the file to the server:

scp ~/.ssh/

Step 6 – (On your server)
I’m assuming you’re still root on the server.
Change to the git user.

su git
cd /home/git
gitosis-init <

It should reply with Initialized empty Git repository in ./ – twice..
We can now remove as we don't need it anymore.


Now we must set some directory and file permissions to let sshd see the new authorized_keys file.

chmod 755 /home/git

chmod 700 /home/git/.ssh

chmod 644 /home/git/.ssh/authorized_keys

Step 7 – (On your client)

We're pretty much done server side. Now we're going to configure the server via the client.

Although I assume this is obvious, you need to install git on your client machine.

git clone

cd gitosis-admin

You should see a gitosis.conf file and keydir directory. Here's the thing, anything you need to configure on the server, you actually configure here and commit the changes to the server. Open up gitosis.conf in your favorite text editor
Make a new group name for your project. It really doesn't matter what you name this group. Add users to the member section who will need push access.
[group myTeam]
members = (copy and paste the user from the members = line in the [group gitosis-admin] section)
writable = myNewProject

Save the file. Why did we use that If you look in the keydir directory, you'll see your public key with the filename These are your users (minus the .pub).

Step 8 – (On your client)
You've just made a configuration change. You want the server to allow to have write access to a project called myNewProject. You must commit this change to the server.

git commit -a -m "Allow the machine I am on right now write access to myNewProject"
git push

Now it's time to make the directory that will contain your project files. Move up out of the gitosis-admin directory.

cd ..
mkdir myNewProject
cd myNewProject
git init
git remote add origin

Add your files, move some files, create some files. Put some files in the myNewProject directory.
Now we can commit the initial push to the server.

git add .
git commit -a -m "This is my initial commit for myNewProject"
git push origin master:refs/heads/master

Git will do some neat things and push things to the server. Now to delete the directory you just created.. Yeah, I said it.

cd ..
rm -fr myNewProject

And now to pull myNewProject from the server using clone..

git clone

Now you have a version of your code you can actually use, make changes and commit to the server using normal git commands.

As of now, you have a fully functioning git server with a project and a client that can make changes. But what about other people?

Step 9 – (On your client)
So your friend Bob wants to help you out with myNewProject. Have Bob generate his own and send it you. When you have it:

cd gitosis-admin

Assuming Bob's is in your home directory, move it to the key directory renaming it at the same time:

mv ~/ keydir/

Tell git about the new file:

git add keydir/

Edit your gitosis.conf file again. Look for the members line in myNewProject and add Bob to it:

members = bob

Now you could add bob to be in the gitosis-admin group if you wanted him to be able to do what you're doing now. How much do you trust Bob?

Save the file and quit. It's time to tell your server about Bob and send Bob's public key.

git commit -a -m "Added commit rights to Bob on myNewProject"
git push

The server will automatically add Bob's public key to authorized_keys. Do not attempt to add him manually.

Step 10 –
Do a little dance, you're done.

header('content-type: image/jpeg');

$imgpath = "../image/path" ; 
//OR $imgpath = $_POST["image"] if you will do this on the fly

$image = imagecreatefromjpeg($imgpath);
$imageSize = getimagesize($imgpath);

$watermark = imagecreatefrompng('watermark/path');

$watermark_o_width = imagesx($watermark);
$watermark_o_height = imagesy($watermark);

$newWatermarkWidth = $imageSize[0]-20;
$newWatermarkHeight = $imageSize[1]; 
// OR $newWatermarkHeight = $watermark_o_height * $newWatermarkWidth / $watermark_o_width; 
// IF you would to fit watermark image with image dim

	$imageSize[0]/2 - 
	$imageSize[1]/2 - $newWatermarkHeight/2, 

// OR imagejpeg($image,"save/image/path"); 
// if you would to save new image


What is a CDN

CDN (Content Delivery Network)

A CDN is a network of servers around the world which have a copy of your website and its small files, so when a visitor loads your website, the CDN delivers your website’s files from the closest server to them. The further the physical distance between the server and the user the slower the website becomes. So by serving from a closer location, the speed of the website increases.

how it works?

Your users could be anywhere in the world yet your hosting is only hosted in one place, let’s say New York. Now if a visitor from England comes to your website they must load your website from New York. The distance the information must travel is very far and will make the website slow for this user. If you had a CDN, it would load your website from a local server, say one in England, so your website for this user would be very fast.