Install Apache2 PHP5 OCI8 on Debian Etch

Filed Under (apache2, debian) by Coni on 30-11-2007

First install php5 pear and build essential alien. I used alien because I used rpm oracle-client version (It’s ligther to download).

# apt-get install php5 php-pear build-essential php5-dev alien

Download oracle client and sdk in http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
Choose oracle-instantclient-basic-10.2.0.3-1.i386.rpm and oracle-instantclient-devel-10.2.0.3-1.i386.rpm
I choose version 10.2.0.3 cause my job is in Oracle 10g. If you want to download 11.1.0.1 that’s ok.
Don’t forget to Accept License Agreement

Install oracle client an sdk using alien :

# alien -vi oracle-instantclient-basiclite-10.2.0.3-1.i386.rpm
# alien -vi oracle-instantclient-devel-10.2.0.3-1.i386.rpm

Let see where it’s installed :

# rpm -qpl oracle-instantclient-basiclite-10.2.0.3-1.i386.rpm
/usr/lib/oracle/10.2.0.3/client/bin/genezi
/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
/usr/lib/oracle/10.2.0.3/client/lib/libnnz10.so
/usr/lib/oracle/10.2.0.3/client/lib/libocci.so.10.1
/usr/lib/oracle/10.2.0.3/client/lib/libociicus.so
/usr/lib/oracle/10.2.0.3/client/lib/libocijdbc10.so
/usr/lib/oracle/10.2.0.3/client/lib/ojdbc14.jar

It’s showed where oracle instant client’s installed.

To install oci8 just use pecl for simple case and answer like I print it. I used oci8-1.2.3 because at this time the newest version is 1.2.4 and it’s unstable and some times cause segmentation fault in apache (See Apache error log).

# pecl install oci8-1.2.3.tgz
downloading oci8-1.2.3.tgz …
Starting to download oci8-1.2.3.tgz (83,591 bytes)
…..done: 83,591 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Please provide the path to ORACLE_HOME dir. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling against Oracle Instant Client [autodetect] : instantclient,/usr/lib/oracle/10.2.0.3/client/lib
building in /var/tmp/pear-build-root/oci8-1.2.3
running: /tmp/pear/cache/oci8-1.2.3/configure –with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
…………
…………
…………
Build process completed successfully
Installing ‘/var/tmp/pear-build-root/install-oci8-1.2.3//usr/lib/php5/20060613+lfs/oci8.so’
install ok: channel://pecl.php.net/oci8-1.2.3
You should add “extension=oci8.so” to php.ini

Like it’s said add “extension=oci8.so” to /etc/php5/apache2/php.ini and restart apache2 :

# /etc/init.d/apache2 restart

Use O2 atom PDA as modem in ubuntu gutsy

Filed Under (linux) by Coni on 17-11-2007

First plug in your usb cable.
see what it’s detect with

lsusb -v

find a name with
“MicroSoft” and “Windows USB Modem”
get the “idVendor” and “idProduct” like this (examples from my device)

idVendor 0×0408 Quanta Computer, Inc.
idProduct 0×0079

that’s explain idVendor is 0×0408 and idProduct is 0×0079
insert to /etc/modules

ipaq vendor=0×0408 product=0×0079

as you see it use id vendor and product from lsusb
or you can directly load it which modprobe with same parameters
look out dmesg and find out the device name
for me it’s

usb 2-3: PocketPC PDA converter now attached to ttyUSB0

so my device name is /dev/ttyUSB0 (used from wvdial)
Done now for load device

For dialing ISP i use wvdial
wvdial is built in feisty than it may be in gutsy to.
Don’t forget to use root user or just sudo as you like
If wvdial is not installed than just simply install it

apt-get install wvdial

Here is a print my /etc/wvdial.conf just for example than you can modify it later

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”www.apn_address.net”
Username = username
Password = password
Phone = *99#
Modem Type = Analog Modem
Stupid Mode = on
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Carrier Check = no
Auto Reconnect = on

I also change ppp configurations in /etc/ppp/options

lcp-echo-failure 0

now run wvdial and wait
If sucess than use ifconfig to show your new interfaces
Here’s my example

ppp0      Link encap:Point-to-Point Protocol
inet addr:172.26.9.244  P-t-P:10.0.0.1  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:26456 errors:0 dropped:0 overruns:0 frame:0
TX packets:26963 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:24710434 (23.5 MB)  TX bytes:2859300 (2.7 MB)

With this I think it’ll compatible for others PDA with windows mobile. Just use different id vendor and product for different PDA as I see.
OK ‘n good luck! ;)

MRTG-RRD at Debian Etch

Filed Under (debian, linux) by Coni on 02-11-2007

Here we want to install mrtg-rrd on debian. It’s quite easy with debian. You don’t need to compile, just use binary package from debian. This section only monitor ethernet usage. For others maybe latter. First use apt-get to install required package

apt-get install mrtg-rrd rrdtool mrtg snmp snmpd apache2

Configure snmpd in file /etc/snmp/snmpd.conf

com2sec readonly default public

Restart snmpd service

/etc/init.d/snmpd restart

Make mrtg.conf

cfgmaker public@localhost > /etc/mrtg.conf

Make mrtg.conf readable by apache users cause apache will read it

chmod o+r /etc/mrtg.conf

Configure mrtg.conf in

WorkDir: /var/mrtg
LogFormat: rrdtool
IconDir: /mrtg
Options[_]: growright, bits

/mrtg is url for mrtg images’s saved
/var/mrtg directory for rrd file

Make directory /var/mrtg and change owner for apache user beacuse apache will create image file in it

mkdir /var/mrtg
chown -R www-data:www-data /var/mrtg/

Finally generate your first rrd data

env LANG=C /usr/bin/mrtg /etc/mrtg.conf

And don’t forget to run cron service
Open your browser and navigate to http://your-server/cgi-bin/mrtg-rrd.cgi
File mrtg-rrd.cgi is located in /usr/lib/cgi-bin/mrtg-rrd.cgi

Visit Yogyakarta / Jogja