Get Apache, MySQL, PHP With mcrypt and phpMyAdmin working on OSX 10.9 Mavericks

One of the best thing about OSX 10.9 Mavericks for web developer is Apache and PHP already installed. You do not have to start the Apache – its automatically starts when mac starts.

Even though you want to start manually

sudo apachectl start

to stop it

sudo apachectl stop

to restart it

sudo apachectl restart

To find the Apache version

httpd -v

Now you can access the it by http://localhost.

The document root is /Library/WebServer/Documents/. But I would suggest you use User Level Root. First create folder “Sites” in your home folder. Now go to /etc/apache2/users/

cd /etc/apache2/users/

Suppose you username is “zakir”. You can found your name


Now create a conf file in /etc/apache2/users/

sudo nano zakir.conf

add the following to zakir.conf

<Directory "/Users/zakir/Sites/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all

Change permission of the zakir.conf

sudo chmod 644 zakir.conf

Now restart the apache

sudo apachectl restart

Now you access it via http://localhost/~zakir/. Now you need change httpd.conf file to allow .htaccess file.

sudo nano /etc/apache2/httpd.conf

Find the line . Change value of AllowOverride To All.

Permission of the Sites folder

sudo chmod go-rwx Sites
sudo chmod go+x Sites
sudo chgrp -R _www Sites
sudo chmod -R go-rwx Sites
sudo chmod -R g+rx Site

If you have mutiple website ie mutiple folders then do the following after creating each folder

sudo chown -R username ~/Sites/folder
sudo chmod go-rwx ~/Sites/folder
sudo chmod go+x ~/Sites/folder
sudo chgrp -R _www ~/Sites/folder
sudo chmod -R go-rwx ~/Sites/folder
sudo chmod -R g+rx ~/Sites/folder

In this way only you can edit the files and others can not edit files. Apache can also run files. To check permission of a file use following line

stat -f %Mp%Lp file

Open httpd.conf file

sudo nano /etc/apache2/httpd.conf

Uncomment “LoadModule php5_module libexec/apache2/” line.
Now restart the apache

sudo apachectl restart

Install mcrypt for PHP
First install xcode and xcode for command line see for details.

Create mcrypt folder in your home folder.

cd ~
mkdir mcrypt
cd mcrypt

Download libmcrypt from and download php source Copy the files to mcrypt folder.
Untar the files

tar -zxvf libmcrypt-2.5.8.tar.gz
tar -zxvf php-5.4.17.tar.gz

Configuring libmcrypt

cd libmcrypt-2.5.8
sudo make install

Compile mcrypt php Extension

cd ../php-5.4.17/ext/mcrypt/
sudo make install

You will see this msg

Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20100525/

Copy php.ini from /etc

sudo cp /etc/php.ini.default /etc/php.ini
sudo chmod u+w  /etc/php.ini

Open /etc/php.ini and add the line below at the end

Now restart the apache

sudo apachectl restart

First download dmg file from Install Install all 3…

Now got System Preference and then got mysql then start mysql

now set mysql password for mysql – I liked to set password blank

/usr/local/mysql/bin/mysqladmin -u root password ''

Fix the 2002 socket error

sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Download phpMyAdmin, the zip package and move the folder with its contents into the ~/Sites/phpmyadmin folder.

Make the config folder and Change the permissions

mkdir ~/Sites/phpmyadmin/config
chmod o+w ~/Sites/phpmyadmin/config

Go to http://localhost/~zakir/phpmyadmin/setup/. Click new server, Switch to the Authentication tab and set the local mysql root user and the password. Make sure you click on save, then a is now in the /config directory of phpmyadmin directory, move this file to the root level of /phpmyadmin and then remove the now empty /config directory.

17. January 2014 by Zakir Hyder
Categories: Apple, Server Management, Web Development | Tags: , , , , , , , , , , , , | Comments

I reviewed “Getting Started with Citrix® CloudPortal™”

I have reviewed the Getting Started with Citrix® CloudPortal™.

  • Overview of CPSM and CPBM architectures, and planning CPSM and CPBM
  • Become efficient in product management, workflow management, and billing and pricing management
  • Provision services efficiently to cloud consumers and clients

14. January 2014 by Zakir Hyder
Categories: Jambura | Comments

How To Apply For Passport in Bangladesh

First of all – be patience.

Prepare following documents
1) 2 photocopies of National ID card
2) Or 2 photocopies of Birth Certificate
3) 2 copies of passport size photos
4) one person who can attest your photos, application and willing to give his/her phone number and his/her nation id in your application.
5) Police will ask for electricity bill so keep a copy of that also
6) If you live on rented house then make copy of National ID of the person whose name is on the electricity bill because Police will ask for it.
7)If you give profession as software engineer make sure you have your hon’s certificate – 2 photocopies.

Its better if you pay your fee first. Then you can finish all formalities of taking photo for passport in one day. Different branch of sonali bank is dedicated to take the fee. My branch was awlad hossain market. Make you you write you name in CAPITAL in the receipt. Also make sure you write the same name as you will give for your passport. Because the officer will check for that. He/she will not accept if both does not match.

Now go to Fill out all information “passport application – Stage 1”. In Stage 2, give correct mobile number and email address. Because police will call you. Make sure you are entering correct Receipt number. It is the number top left corner. Or you can ask which is the Receipt number when you are paying the fees at the Bank. An email will be sent with link. You can download download pdf. Print that out – TWO copies.

Now affix the photo on first page and write your name in Bangla on first page – in both copies. Now go to the person who will attest your from. Make sure attest over the photo on the first page and fourth page. On fourth page enter his/her address, phone number and passport/nation id. Now attest all of your photocopies. Sign on page 3.

Now you will affix the receipt you got from bank on first page of one of the copy. Affix it bellow the bar code. You need to affix it on one copy not both.

Now go to the passport office next day. I would suggest go to the office as early as possible. If possible go at 7:30 AM. They will let you in at 8:45 AM. after army person gives stamp on you from go directly 2nd floor room 301. After the officer gives ok to your forms and gives stamp – go to ground floor. Near the stair you will see two army person sitting – Show your forms. They will give another stamp. Now go to the 3rd floor. There is only one army person sitting. Show you forms and he will give you serial number. Wait for your number. When they will call that number, go to the room let them take you photograph and finger print. They will give you printed page. Now go home and wait for police to call.

When police calls, make sure you have the photocopy of your National ID & electricity bill ready. Keep his mobile number saved. Call the police officer after 1/2 days to make sure he sent the police report to Special Branch. Now go to Special Branch and get a receipt number from reception. Now take that number to passport office after launch . Go to 2nd floor/3rd floor. Ask someone to check you police report came or not. If not then show your receipt number. Then your number will be written in their ledger. Now all you have to do, is to go to passport office at date mention on the printed paper.

02. January 2014 by Zakir Hyder
Categories: Jambura | Comments

Use Only Bootstrap’s Modal component Not All The Whole Framework

Bootstrap comes with 13 components and some other helpers. I use the modal component most. Some times I just want to use just the modal not the others. So I am going show how you can use only the modal without using the whole Framework. First go to You can use the same technique for Bootstrap version 3.

First Select following checkbox – Buttons(Base CSS), Modals(JS Components), Close icon, Component animations(miscellaneous)

Then select jQuery plugins – Transitions, Modals, Buttons

Then change top: -25%; to top: -125%;

.modal.fade {
  -webkit-transition: opacity .3s linear, top .3s ease-out;
  -moz-transition: opacity .3s linear, top .3s ease-out;
  -o-transition: opacity .3s linear, top .3s ease-out;
  transition: opacity .3s linear, top .3s ease-out;
  top: -125%;

To customise the css in modal content use the following css

.modal h1,
h6 {
  margin: 10px 0;
  font-family: inherit;
  font-weight: bold;
  line-height: 1;
  color: inherit;
  text-rendering: optimizelegibility;

.modal label,
textarea {
  font-size: 12px;
  font-weight: normal;
  line-height: 18px;

.modal p {
margin: 0 0 10px;

28. November 2013 by Zakir Hyder
Categories: CSS, Web Development | Tags: , , , , , , , , , | Comments

Install memcached in Mac OS and using it in Perl

memcached is quite powerful but easy to use caching system. I would suggest you to read this wonderful story to make you understand how it works.

To install memcached in Mac os we going to use brew. You can follow to install brew.

brew update
brew install memcached

Then add memcached to launchctl

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist

You can run as daemon also

memcached -l -p 11211 -d

There two Perl library I found Cache::Memcached::Fast and Cache::Memcached. While using Cache::Memcached I found this error “Storable binary image v48.98 more recent than I am (v2.8)”. Which is happening in line 417. While searching for solution, I found its much harder to fix. So its better to use Cache::Memcached::Fast. Its quite easy to use.

my $memd = new Cache::Memcached::Fast{servers => [$self->memd_server], compress_threshold => 100_000};
my $sub_tree_path = 'cat/car', my $attr = [1,2,3];
$memd->set($sub_tree_path, $attr);
my $memd_attr = $memd->get($sub_tree_path);

26. November 2013 by Zakir Hyder
Categories: Caching, Perl | Tags: , , , , | Comments

Style a Select Box Using CSS

Recently while working on new design for cellbazaar mobile which will only load on smart phone, I found way to design select box only using text-indent and text-overflow. BTW -moz-appearance does not work in Firefox :(. So this implementation is necessary when you are designing custom select box.

My plan is to make this into


Into this

Here is css code

.styled-select {
   overflow: hidden;
   background: #F8F8F8;
   border: 1px solid #DDDDDD;
   height: 30px;

.styled-select select {
  width: 100%;
  border: 0;
  line-height: 1.5;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-indent: 0.01px;
  text-overflow: '';
  appearance: none;
  background: transparent url("/img/smart_arrows.png") no-repeat scroll 97% 8px;
  @media (-webkit-min-device-pixel-ratio: 2), 
    (min-resolution: 192dpi) {
      background: transparent url("/img/smart_arrows@2x.png") no-repeat scroll 97% 8px;
      background-size: 16px 144px;

Basically the .styled-select container div which will hold the select box. It’s overflow property is hidden so if the select box moves to right it wont show any bars. So the html code is like this

<div class="styled-select">
  <select >  
    <option value="">From</option> 

If you are wondering about “@media (-webkit-min-device-pixel-ratio: 2)” see this Retina displays High Resolution Background Image.

05. November 2013 by Zakir Hyder
Categories: CSS, HTML | Tags: , , , , , | Comments

I Reviewed The “Twilio Cookbook”

I have reviewed the Twilio Cookbook. This book is all you need to know about Twilio.

  • Add 2-factor authentication to your web apps to verify your users
  • Set up a company directory
  • Buy a phone number
  • Conduct surveys using SMS
  • Set up a conference calling system
  • Use APIs to build a local search system for finding businesses, movies, and weather forecasts
  • Delve into SMS messaging and learn how to set up order tracking, bulk SMS sending, and a group chat system
  • Set up an appointment reminder using SMS
  • Build an interactive IVR menu system
  • Build your first PVR
  • Learn about OpenVBX plugins to extend its existing functionality
  • Verify that a person is answering the phone and not a machine

17. October 2013 by Zakir Hyder
Categories: twillo | Tags: , , , , | Comments

← Older posts

Newer posts →