Posted on 27-09-2014
Filed Under (Apache) by pbabar



Here’s an open source IaaS platform to set up an on-demand, elastic cloud computing service. It enables utility computing services by allowing cloud service providers to offer self-service compute instances, storage volumes and networking configurations, and to set up a private cloud for internal use.

Apache CloudStack is an open source, multi-tenanted cloud orchestration platform, which is used to build private, public and hybrid IaaS clouds by pooling computing resources. It manages computing, networking and storage resources. CloudStack is hypervisor agnostic; it uses multiple virtualisation platforms such as KVM, vSphere and XenServer. It supports the Amazon Web Services API, apart from its own APIs.

Features and use cases:
CloudStack supports Citrix XenServer, VMware vSphere and KVM on Ubuntu or CentOS. It can manage multiple geographically distributed data centres. The CloudStack API gives programmatic access to all managed resources and hence it is easier to create command line tools. Multi-node installation support and load balancing makes it highly available. In addition, MySQL replication is also useful for maintaining high availability.

Service providers and organisations use CloudStack to set up an elastic and on-demand IaaS. It can also be used to set up an on-premise private cloud behind the organisation’s firewall for internal purposes like gaining better control over infrastructure.


A host is a computer that provides the computing resources such as the CPU, storage, memory, networking, etc, to run the virtual machines. Each host has a hypervisor installed to manage the VMs. As CloudStack is hypervisor agnostic, multiple hypervisor-enabled servers such as a Linux KVM-enabled server, a Citrix XenServer server and an ESXi server can be used.

One or more primary storage is coupled with a cluster that stores the disk volumes for all the VMs running on hosts in that specific cluster.
A cluster consists of one or more hosts and one or more primary storage servers. In other words, a cluster can be considered as a set of XenServer servers or a set of KVM servers.

A CloudStack pod represents a single rack. A CloudStack pod consists of one or more clusters of hosts and one or more primary storage servers. Hosts in the same pod are in the same subnet.

A zone typically corresponds to a single data centre; it is permissible to have multiple zones in a data centre. Pods are contained within zones. Each zone can contain one or more pods. Zones can be public or private.

Secondary storage is shared by all the pods in the zone that stores templates, ISO images and disk volume snapshots.

 A CloudStack installation consists of a management server and the cloud infrastructure. Hosts, storage and IP addresses are managed by the management server. The minimum installation consists of one virtual machine running the CloudStack management server and another virtual machine to act as the cloud infrastructure the host running the hypervisor software.

The management server manages cloud resources, and the administrator can manage and interact with the management server by using a UI and APIs. It also managew s the assignment of guest VMs to particular hosts, the assignment of public and private IP addresses, templates and ISO images, as well as snapshots.

The CloudStack API:

 The CloudStack API supports three access roles: root admin, domain admin and user. The root admin can access all the features in addition to both virtual and physical resource management; the domain admin can access only the virtual resources that belong to the administrator’s domain, while the user can access the features that allow the management of the user’s virtual machines, storage and network.

To use the CloudStack API, knowledge of Java or PHP, HTTP GET/POST and query strings, XML or JSON, URL of the CloudStack server, and API key and secret key is necessary.


Pravin Babar.


(0) Comments   

Yesterday, I experienced very strange problem, that comes first time (for me), so checked things with apache and modules as diff way, but at the end got it fixed with the help of apache wiki 🙂  Thanks to make it perfect !!

There was something bad going with the apache and I was trying to fix it, as I need to restart it to first fix, but It can’t started, just popup message “[FAILED]”, surprised, ran twice to start it, then checked the error logs for debugging it and found the new error logged into messages.

[Thu Mar 10 00:58:59 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Mar 10 00:58:59 2011] [error] (28)No space left on device: Cannot create SSLMutex
Configuration Failed

I found the page where all the related errors are listed by Apache , this helps me to fix this error.

“This error indicates that the server has run out of available slots for “inter-process communication“. This can occur when a process crashes before cleaning up after itself.The ipcs command will list semaphores and shared memory slots in use. If there is a large number of entries in use by the apache user use ipcrm to remove them. Then, check your server’s error log (possibly with LogLevel debug set) to figure out why it’s crashing, or see:

[root@testbed ~]# ipcs -s |grep apacheuser
—— Semaphore Arrays ——–
key        semid      owner      perms      nsems
0x00000000 26836992   apacheuser 600        1
0x00000000 26902529   apacheuser 600        1
0x00000000 26935298   apacheuser 600        1
0x00000000 27361283   apacheuser 600        1
0x00000000 27426820   apacheuser 600        1
0x00000000 27459589   apacheuser 600        1
0x00000000 22937608   apacheuser 600        1
0x00000000 23003145   apacheuser 600        1
0x00000000 23035914   apacheuser 600        1
0x00000000 33456140   apacheuser 600        1
0x00000000 34308109   apacheuser 600        1
0x00000000 34340878   apacheuser 600        1
0x00000000 48791567   apacheuser 600        1
0x00000000 49053712   apacheuser 600        1
0x00000000 49086481   apacheuser 600        1

[root@testbed ~]# ipcs -s |grep apacheuser | awk ‘{print $2}’

[root@testbed ~]# ipcs -s |grep apacheuser | awk ‘{print $2}’| xargs ipcrm sem
resource(s) deleted

[root@testbed ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]



(0) Comments   
Posted on 20-10-2010
Filed Under (Apache, Perl & Python, UNIX/Linux) by Arun Bagul

Introduction –

Almost  2 year back (today also!)  I struggled a lot for implementing session and cookie in Perl CGI application.  So thought to share my work with you all. I wanted to do it in my way…

Assumption, your web server ie Apache is enabled to run CGI scripts

CGI directory location – /var/application/www/cgi-bin/
Htdocs location – /var/application/www/
Perl Module direcotry – /var/application/module/

Step 1] Write Perl module –

Please simply copy following perl module for authentication using Session and Cookies…

[root@arun ~]# cat /var/application/module/

package Auth;

### Subroutine to authenticate user
sub  User
my ($ref_page) = (@_);
### Session information
my $sid = $ref_page->cookie("APP_SID") || undef;
my $session = CGI::Session->load(undef,$sid);
if ( $session->is_expired ) { print $ref_page->redirect(-location => '../arun.html');}
elsif ( $session->is_empty) { print $ref_page->redirect(-location => '../arun.html');}
else { print $ref_page->header();}
# don't forget to create dir '/var/tmp'
# with proper ownership/permission
#$session = new CGI::Session(undef, $sid, {Directory=>'/var/tmp'});

[root@arun ~]#

Step 2] – file is used to set cookies and verify username/password. You may use MySQL DB to store username and password.  In this case you have to this file…

[root@arun ~]# cat /var/application/www/cgi-bin/

unshift (@INC, '/var/application/module/');

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Session;
use Auth; ## our module

### Header
my $page = CGI->new();
##print $page->header();

my %form;
my $session_dir="/var/tmp";
 my ($admin_user,$admin_password) = ("admin","arun123");

foreach my $key (param()) { $form{$key} = param($key);}
if (($form{username}) && ($form{password}))

### Session Details ###
## Create new session
my $session = new CGI::Session(undef, undef, {Directory=>$session_dir});
 ## Set cookies
my $cookie = $page->cookie(-name=>$session->name(),-value=>$session->id(),-expires=>'+2h',-path=>'/');
## Store data in session variable and save it
$session->param('login_user',$form{username}); # OR
$session->save_param($page, ["login_user"]);

## Session and Cookie expiration time is SAME.
#### Session Details end ####

## if login successful redirect to else login page
if (($form{username} eq $admin_user) and ($form{password} eq $admin_password))
{ print $page->redirect(-location => '',-cookie=>$cookie);}
else { print $page->redirect(-location => '../arun.html'); }
} else { print $page->redirect(-location => '../arun.html'); }

[root@arun ~]#

Step 3] Create Login Page –

[root@arun ~]# cat /var/application/www/arun.html
<title>Arun Login Page</title>

<!-- Form start -->
<table align='center' border='1'>
<form method="POST" action="cgi-bin/">
<td><input name="username" type="text"></td>
<td><input name="password" type="password"><br/></td>
<td><input value="Submit" type="submit"></td>



[root@arun ~]#

Step 4] Create main page where Session and Cookie authentication verified –

[root@arun ~]# cat /var/application/www/cgi-bin/

unshift (@INC, '/var/application/module/');

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Session;
use Auth;

### Header
my $page = CGI->new();
## check authentication
my $login_name=Auth::User($page);
print $page->start_html( -title=>'Arun Main Page');

print "<h3>This is Main Page</h3></br>";
print "<br>Login Name - $login_name";

[root@arun ~]#

Step 5] Please access login page and try http://your_ipaddr/arun.html

Thank you,

(2) Comments   

*** Introduction –

All you know about the haproxy, that its the one of the good opensource load balancing software and to check the fun stats of haproxy here we using ‘socat’ – Multipurpose relay (SOcket CAT)

* What is socat?

Socat  is  a  command  line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be constructed from a large set of different types of data sinks and sources (see address  types),  and  because  lots  of address options may be applied to the streams, socat can be used for many different purposes. (see more info at ‘man socat’ 🙂 or at
* How to use ‘socat’ with haproxy stat

Step 1) Download ‘socat’ from  latest version ~ “socat-2.0.0-b3.tar.gz”

ravi@arun:~$ wget

ravi@arun:~$ tar xvzf socat-

ravi@arun:~$ cd socat-

NOTE ~ No need to install the ‘fipsld’ package if you got the below msg after running the ‘make’ just following steps for

compiling socat….

FIPSLD_CC=gcc fipsld -O -D_GNU_SOURCE -Wall -Wno-parentheses  -DHAVE_CONFIG_H -I.  -I.   -c -o socat.o socat.c
/bin/sh: fipsld: command not found
make: *** [socat.o] Error 127

ravi@arun:~$ ./configure –disable-fips
ravi@arun:~$ make

To install it login as root
ravi@arun:~$ su –

ravi@arun:~# make install

Step 2) Now you need to add stats socket PATH in Haproxy configuration and restart haproxy as per shown in following example,

where I have added it under in ‘global’ setting –

ravi@arun:~# more /etc/haproxy/myhaproxy.cfg

#———–Start of haproxy Config file————–
log   local0
log   local1 notice
#log loghost    local0 info
maxconn 25000
user ravi
group ravi
stats socket    /tmp/haproxy
option          contstats
timeout         connect 5s
timeout         client 25s
timeout         server 25s
maxconn         100

listen ravitestbed IP
mode            tcp
balance         roundrobin
server          web1
server          web2

listen stats
mode            http
#stats          uri /stat  #Comment this if you need to specify diff stat path for viewing stat page
stats enable
stats auth admin:admin ##Auth user pass

#———–End of haproxy Config file————–

Step 3) Used /tmp/haproxy. Now you can send the commands to get stats from HAProxy –

Now time to use socat

ravi@arun:~# echo “”  | socat unix-connect:/tmp/haproxy stdio
Unknown command. Please enter one of the following commands only :
show info   : report information about the running process
show stat   : report counters for each proxy and server
show errors : report last request and response errors for each proxy
show sess   : report the list of current sessions

This will dump (possibly huge) info about all know sessions.

ravi@arun:~$ echo “show sess” | socat unix-connect:/tmp/haproxy stdio
0x9ee3520: proto=tcpv4 src= fe=ravitestbed be=ravitestbed srv=arun as=0 ts=08 age=4s calls=3
rq[f=009202h,l=0,an=00h,rx=20s,wx=,ax=] rp[f=009202h,l=0,an=00h,rx=20s,wx=,ax=] s0=[7,8h,fd=1,ex=] s1=[7,8h,fd=2,ex=] exp=20s
0x9eeb8e8: proto=tcpv4 src= fe=ravitestbed be=ravitestbed srv=arun as=0 ts=08 age=4s calls=3
rq[f=009000h,l=0,an=00h,rx=20s,wx=,ax=] rp[f=009202h,l=0,an=00h,rx=20s,wx=,ax=] s0=[7,8h,fd=8,ex=] s1=[7,8h,fd=9,ex=] exp=20s
0x9ef3d08: proto=tcpv4 src= fe=ravitestbed be=ravitestbed srv=arun as=0 ts=08 age=4s calls=3
rq[f=009000h,l=0,an=00h,rx=20s,wx=,ax=] rp[f=009202h,l=0,an=00h,rx=20s,wx=,ax=] s0=[7,8h,fd=12,ex=] s1=[7,8h,fd=13,ex=]
0x9f04548: proto=unix_stream as=2 ts=09 age=0s calls=2 rq[f=00e042h,l=10,an=20h,rx=10s,wx=,ax=]

rp[f=048060h,l=716,an=00h,rx=,wx=10s,ax=] s0=[7,0h,fd=3,ex=] s1=[0,0h,fd=-1,ex=] exp=9s

This will give you information about the running HAProxy process such as pid, uptime and etc.

ravi@arun:~$ echo “show info” | socat unix-connect:/tmp/haproxy stdio
Name: HAProxy
Version: 1.3.23
Release_date: 2010/01/28
Nbproc: 1
Process_num: 1
Pid: 11829
Uptime: 0d 0h42m53s
Uptime_sec: 2573
Memmax_MB: 0
Ulimit-n: 50013
Maxsock: 50013
Maxconn: 25000
Maxpipes: 0
CurrConns: 1
PipesUsed: 0
PipesFree: 0
Tasks: 1
Run_queue: 1

This will give you stats on all of your backends and frontends, some of the same stuff you see on the stats page enabled by the stats uri configuration. As an added bonus it’s all in CSV.

ravi@arun:~$ echo “show stat” | socat unix-connect:/tmp/haproxy stdio
ravitestbed,trupti,0,0,0,2,,15,7020,22722,,0,,0,0,0,0,no check,1,1,0,,,,,,1,1,1,,15,,2,0,,2,
ravitestbed,arun,0,0,0,5,,15,25562,27894,,0,,0,0,0,0,no check,1,1,0,,,,,,1,1,2,,15,,2,0,,3,

show errors will give you a capture of last error on each backend/frontend.

ravi@arun:~$ echo “show errors” | socat unix-connect:/tmp/haproxy stdio


Thanks to Joe (

Thank you,

(0) Comments   

Many times  haproxy and apache does not reliable to serve the connections without tune or we say we need to set system as well some kernel parameters to work it better.

Here haproxy gives an errors to connect to apache, at that time it logs the errors into ‘dmesg | tail’ or in ‘/var/log/messages’ “kernel: ip_conntrack: table full, dropping packet” that is related to ip_conntrack kernel module.

Conntrack table is hash table (hash map) of fixed size (8192 entries by default), which is used for primary lookup. When the slot in the table is found it points to list of conntrack structures, so secondary lookup is done using list traversal. 65536/8192 gives 8 – the average list length. You may want to experiment with this value on heavily loaded systems.

If this error founds into /var/log/messages or dmesg you have to apply following steps to resolve.

Here I have done this to changes and added few settings in kernel also we will do it to set apache MPM and Haproxy tunning with sysctl.conf

Note: I have tried all this workaround and apply on CentOS-5.2, but don’t worry ip_conntrack module is default in kernel 2.6 +

1) To check ip_contrack is compiled with your kernel

[ ~]# modinfo ip_conntrack
filename:       /lib/modules/2.6.18-128.el5/kernel/net/ipv4/netfilter/ip_conntrack.ko
license:        GPL
srcversion:     F1390E605BBFB05078B78E8
depends:        nfnetlink
vermagic:       2.6.18-128.el5 SMP mod_unload gcc-4.1
module_sig:     883f350497747c575ed35fe9471dce112565509f4b58f4f3e440c6bcc05c2fba9bbdd224bdeb8209e293da385133a876e44a7b449ba59a882a8282b

2) Probe ip_conntrack kernel module or add it in /etc/modprobe.conf

[ ~]# modprobe ip_conntrack hashsize=131072


open /etc/modprobe.conf and add below lines at the end of file

options ip_conntrack hashsize=131072

3) before go to apply the 4th step, just check the ip_conntrack setting is into /etc/sysctl.conf

grep “ip_conntrack” /etc/sysctl.conf

if its found then apply 4th step or edit the /etc/sysctl.conf and add the given two lines at the end of file and save it then go for 4th step
(the value is compare to your RAM and set it to below)

net.ipv4.ip_conntrack_max = 16777216
net.ipv4.netfilter.ip_conntrack_max = 16777216

4) To apply the sysctl parameters run ‘sysctl -p’

[ ~]# sysctl -p

5) Now check the ip_conntrack is logging the connections and check not dropping any more

[ ~]# cat /proc/slabinfo | grep conn
ip_conntrack_expect      0      0    136   28    1 : tunables  120   60    8 : slabdata      0      0      0
ip_conntrack      216053 231335    304   13    1 : tunables   54   27    8 : slabdata  17795  17795    216

6) Also you can check how much memory utilized by ip_conntrack module per connection.

[ ~]# grep ip_conntrack /var/log/messages

/var/log/messages.2:Jan 14 21:46:04 ravi kernel: ip_conntrack version 2.4 (8192 buckets, 65536 max) – 304 bytes per conntrack

1M connections would require 304MB of kernel memory.


(0) Comments   

Here I have used php version 5.2.11 and to jdk-6u18-linux-x64.bin

( from given JAVA download link)

[ ~]# yum  -y install httpd php php-devel php-gd php-cli php-xml php-ldap php-common php-pear php-pdo

Install java jdk and set env in ~/.bashrc also run this on CLI to verify before next step.

export JAVA_HOME=//usr/java/jdk1.6.0_18
export PATH=/usr/java/jdk1.6.0_18/bin:$PATH

[ ~]# echo $JAVA_HOME

Now set the dynamic linker library path into /etc/


[ ~]# ldconfig

Now download php-java-bridge source rpm

[ ~]# wget

unpack the php-java-bridge rpm

[ ~]# rpm2cpio php-java-bridge-4.1.8-1.src.rpm | cpio -ivd
16155 blocks

untar the php-java-bridge and configure the module

[ ~]# tar xzf php-java-bridge_4.1.8.tar.gz && cd php-java-bridge-4.1.8

[ ~]# phpize

[ ~]# ./configure –with-java=$JAVA_HOME  &&  make &&  make install

[ ~]# echo “” > /etc/php.d/java.ini

open the php.ini and edit the at the end of file


Now restart apache
[ ~]# /etc/init.d/httpd restart

[ ~]# php -i | grep java
java support => Enabled
java bridge => 4.1.8
java.java_home => => java
java.log_file => <stderr>
java.log_level => no value (use back-end’s default level)
java.security_policy => Off
java command =>  LD_LIBRARY_PATH=/usr/lib64/php/modules:/usr/lib/ java -Djava.library.path=/usr/lib64/php/modules -Djava.class.path=/usr/lib64/php/modules/JavaBridge.jar -Djava.awt.headless=true LOCAL:9267 1
java status => running
java server => 9267
PATH => /usr/java/jdk1.6.0_18/bin:/usr/java/jdk1.6.0_18/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
JAVA_HOME => /usr/java/jdk1.6.0_18
_SERVER[“PATH”] => /usr/java/jdk1.6.0_18/bin:/usr/java/jdk1.6.0_18/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
_SERVER[“JAVA_HOME”] => /usr/java/jdk1.6.0_18
_ENV[“PATH”] => /usr/java/jdk1.6.0_18/bin:/usr/java/jdk1.6.0_18/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
_ENV[“JAVA_HOME”] => /usr/java/jdk1.6.0_18

Test your code in test.php and run to check
// get instance of Java class java.lang.System in PHP
$system = new Java(‘java.lang.System’); // demonstrate property access
print ‘Java version=’.$system->getProperty(‘java.version’).’ ‘;
print ‘Java vendor=’ .$system->getProperty(‘java.vendor’).’ ‘;
print ‘OS=’.$system->getProperty(‘’).’ ‘.
$system->getProperty(‘os.version’).’ on ‘.
$system->getProperty(‘os.arch’).’ ‘; // java.util.Date example
$formatter = new Java(‘java.text.SimpleDateFormat’,
“EEEE, MMMM dd, yyyy ‘at’ h:mm:ss a zzzz”); print $formatter->format(new Java(‘java.util.Date’));

[ ~]# php test.php
Java version=1.6.0_18 Java vendor=Sun Microsystems Inc. OS=Linux 2.6.18-53.el5xen on amd64 Friday, January 22, 2010 at 4:44:48 AM Pacific Standard Time


(2) Comments   
Posted on 19-01-2010
Filed Under (Apache, PHP & Java Script, Redhat & Fedora) by Ravi Bhure

To enable pdo_oci module you may need to install oracle client and oci8 module is require. I have installed oracle 10g client here.

[ ~]# export ORACLE_HOME=/usr/lib/oracle/ ; export LD_LIBRARY_PATH=/usr/lib/oracle/
[ ~]# cd /tmp
[ tmp]# pecl download pdo_oci
[ tmp]# tar xvzf PDO_OCI-1.0.tar.gz
[ tmp]# cd PDO_OCI-1.0 && phpize
[ tmp]# ./configure
[ PDO_OCI-1.0]# make
/bin/sh /tmp/PDO_OCI-1.0/libtool –mode=compile gcc -I/usr/include/php/ext -I. -I/tmp/PDO_OCI-1.0 -DPHP_ATOM_INC -I/tmp/PDO_OCI-1.0/include -I/tmp/PDO_OCI-1.0/main -I/tmp/PDO_OCI-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/PDO_OCI-1.0/pdo_oci.c -o pdo_oci.lo
mkdir .libs
gcc -I/usr/include/php/ext -I. -I/tmp/PDO_OCI-1.0 -DPHP_ATOM_INC -I/tmp/PDO_OCI-1.0/include -I/tmp/PDO_OCI-1.0/main -I/tmp/PDO_OCI-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/PDO_OCI-1.0/pdo_oci.c  -fPIC -DPIC -o .libs/pdo_oci.o
In file included from /tmp/PDO_OCI-1.0/pdo_oci.c:31:
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:21:17: error: oci.h: No such file or directory
In file included from /tmp/PDO_OCI-1.0/pdo_oci.c:31:
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:26: error: expected specifier-qualifier-list before ‘sb4’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:32: error: expected specifier-qualifier-list before ‘OCIServer’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:48: error: expected specifier-qualifier-list before ‘OCIDefine’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:62: error: expected specifier-qualifier-list before ‘OCIStmt’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:73: error: expected specifier-qualifier-list before ‘OCIBind’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PDO_OCI_INIT_MODE’
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/tmp/PDO_OCI-1.0/php_pdo_oci_int.h:89: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_oci_error’
/tmp/PDO_OCI-1.0/pdo_oci.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PDO_OCI_INIT_MODE’
/tmp/PDO_OCI-1.0/pdo_oci.c:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/tmp/PDO_OCI-1.0/pdo_oci.c: In function ‘zm_startup_pdo_oci’:
/tmp/PDO_OCI-1.0/pdo_oci.c:96: error: ‘pdo_oci_Env’ undeclared (first use in this function)
/tmp/PDO_OCI-1.0/pdo_oci.c:96: error: (Each undeclared identifier is reported only once
/tmp/PDO_OCI-1.0/pdo_oci.c:96: error: for each function it appears in.)
/tmp/PDO_OCI-1.0/pdo_oci.c:96: error: ‘PDO_OCI_INIT_MODE’ undeclared (first use in this function)
/tmp/PDO_OCI-1.0/pdo_oci.c: In function ‘zm_shutdown_pdo_oci’:
/tmp/PDO_OCI-1.0/pdo_oci.c:111: error: ‘dvoid’ undeclared (first use in this function)
/tmp/PDO_OCI-1.0/pdo_oci.c:111: error: expected expression before ‘)’ token
make: *** [pdo_oci.lo] Error 1

Is this the error that pdo does not connect to oci library and its find these into include subfolder, so you may need to copy all the files into include folder.

[ PDO_OCI-1.0]# cp -f /usr/include/oracle/* /tmp/PDO_OCI-1.0/include/

Now run make & make install to compile and install the module.

[ PDO_OCI-1.0]# make && make install

enable the pdo_oci extension with php.

[ PDO_OCI-1.0]# echo “” > /etc/php.d/pdo_oci.ini

[ PDO_OCI-1.0]# php -m | grep pdo_oci

To work pdo_oci properly you have to restart apache.



(0) Comments   
Posted on 11-01-2010
Filed Under (Apache, Redhat & Fedora) by Ravi Bhure

How to install GeoIP and mod_geoip2 on centos for apache

1) yum install GeoIP GeoIP-devel GeoIP-data zlib-devel

2) mkdir /usr/local/share/GeoIP

3) Download the latest Country and City database files from maxmind

cd /usr/local/share/GeoIP
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz

4) yum install httpd-devel apr-devel

5) wget

6) tar xvzf mod_geoip2_1.2.5.tar.gz && cd mod_geoip2_1.2.5

7) apxs -i -a -L/usr/lib64 -I/usr/include -lGeoIP -c mod_geoip.c

8) Enabling mod-geoip
Nothing’s going to work unless mod-geoip is enabled in your apache configuration. You’ll need the following lines in your httpd.conf file (located on CentOS systems at /etc/httpd/conf/httpd.conf)

<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/local/share/GeoIP/GeoLiteCity.dat Standard

9) Restart Apache so your changes will take effect by entering the following command.

#/etc/init.d/httpd restart

10) /usr/local/bin/geoipupdate

(9) Comments   

In my last post, we have seen how we build rpm package for apache with default mpm-worker now it this tutorial we will see how we build rpm of php that can work with apache with mpm-worker.

Download php source rpm from

To resolve the dependancies to build RPM package for PHP installing the require some lib packages

[root@testbed2:/tmp]# yum install bzip2-devel curl-devel gmp-devel aspell-devel libjpeg-devel libpng-devel pam-devel openssl-devel sqlite-devel pcre-devel krb5-devel libc-client-devel mysql-devel postgresql-devel unixODBC-devel libxml2-devel net-snmp-devel libxslt-devel libxml2-devel ncurses-devel gd-devel freetype-devel

install source rpm using
[root@testbed2:/tmp]# rpm -i php-5.1.6-20.el5.src.rpm

[root@testbed2:/tmp]# cd /usr/src/redhat/SPECS

vi php.spec and find “%configure” (without quote) where you can put the “–enable-maintainer-zts \” (without quote)

then rebuild rpm using below command

[root@testbed2:/usr/src/redhat/SPECS]# rpmbuild -bb php.spec

after creating rpm you will find all rpm in /usr/src/redhat/RPMS/{your arch folder} folder
in my condition the rpm’s in /usr/src/redhat/RPMS/x86_64

now change the httpd mpm to worker

[root@testbed2:/usr/src/redhat/X86_64]# /etc/init.d/httpd stop

edit file /etc/sysconfig/httpd

just uncomment the HTTPD=/usr/sbin/httpd.worker line

save and exit then start the httpd service

Now install php rpms from /usr/src/redhat/RPMS/{your arch folder}

[root@testbed2:/tmp]# /etc/init.d/httpd start
[root@testbed2:/tmp]# httpd -V
[root@testbed2:/tmp]# php -v

This is the way that I have done this. I know people are many way and good idea’s to do this.

So keep commenting that update that the things.

(0) Comments   
Posted on 14-09-2009
Filed Under (Apache, Redhat & Fedora, UNIX/Linux) by Ravi Bhure

Guy’s since I started working on apache, I found that apache is most use ful web technology over network.
Everyone knows that (multi-processing module) MPM Prefork is default included in apache rather than MPM Worker.

MPM Prefork = This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other.
MPM Worker = This Multi-Processing Module (MPM) implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with fewer system resources than a process-based server. However, it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.

More information is available on manuals

On RPM based OS’s, apache is default with MPM-Prefork so we will build apache RPM (with default MPM-worker) for our own, don’t know this will be useful or now but will have know everyone with this 🙂

Download the source rpm packages from

[root@testbed2:/tmp]# wget

install http source rpm

[root@testbed2:/tmp]# rpm -ivh httpd-2.2.3-22.el5.centos.src.rpm

[root@testbed2:/tmp]# cd /usr/src/redhat/SPECS

edit httpd.spec with vi editor

[root@testbed2:/usr/src/redhat/SPECS]# vi httpd.spec

find the –with-mpm and enter below config parameter under the –with-mpm

–enable-headers –enable-uniqueid \
–enable-deflate \
–enable-mime-magic \
–enable-so –enable-rewrite \
–enable-http \
–enable-log-config \
–with-libexpat=built-in \

Now find the “mpmbuild prefork”  and replace with “mpmbuild worker”

Now find the “mpmbuild worker” and replace with “mpmbuild prefork”
(you may find this, just few line below)

and most important thing is that you have to comment some lines i.e. (./prefork/httpd -l | grep -v prefork > prefork.mods to done)

find and comment from “./prefork/httpd -l | grep -v prefork > prefork.mods” to “Done” (i.e. just total 8 lines)

Now time to build http with mpmworker for that some dependancies are comes that we will resolve using yum

yum install xmlto db4-devel expat-devel libselinux-devel  apr-devel apr-util-devel pcre-devel openssl-devel distcache-devel

[root@testbed2:/usr/src/redhat/SPECS]# rpmbuild -bb httpd.spec

you have wait for few min and watch whats going on screen ……

your rpm build is created and placed into /usr/src/redhat/RPMS/x86_64

Now install the packages and check with ‘httpd -V’


(0) Comments    Read More
arunbagul's photos More of arunbagul's photos
Get Adobe Flash player