Compile PHP 5.2.17 using phpfarm

In general phpfarm is working well in case you need multiple php environment in single machine. Special case is for PHP 5.2.17 (latest version of 5.2 generation), I got this error when compile :

opt/phpfarm/src/php-5.2.17/ext/dom/node.c: In function ‘zim_domnode_getNodePath’:
/opt/phpfarm/src/php-5.2.17/ext/dom/node.c:2002:8: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
value = xmlGetNodePath(nodep);
^
make: *** [ext/dom/node.lo] Error 1
make failed.

Google suggest me for apply patch.

php programmer

$cd php-5.2.17

$sudo curl -o php-5.2.17.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  1817  100  1817    0     0    722      0  0:00:02  0:00:02 –:–:–   722

run the patch ::

$sudo patch -p0 -b < php-5.2.17.patch

patching file ext/dom/node.c
Hunk #1 succeeded at 1950 (offset 55 lines).
patching file ext/dom/documenttype.c
Hunk #1 succeeded at 215 (offset 10 lines).
patching file ext/simplexml/simplexml.c
Hunk #1 succeeded at 1343 (offset -74 lines).

$cd ..

$ sudo ./compile.sh 5.2.17

and finally get this :

Build complete.
Don’t forget to run ‘make test’.

Installing PHP SAPI module:       cgi
Installing PHP CGI binary: /opt/phpfarm/inst/php-5.2.17/bin/
Installing PHP CLI binary:        /opt/phpfarm/inst/php-5.2.17/bin/
Installing PHP CLI man page:      /opt/phpfarm/inst/php-5.2.17/man/man1/
Installing build environment:     /opt/phpfarm/inst/php-5.2.17/lib/php/build/
Installing header files:          /opt/phpfarm/inst/php-5.2.17/include/php/
Installing helper programs:       /opt/phpfarm/inst/php-5.2.17/bin/
program: phpize
program: php-config
Installing man pages:             /opt/phpfarm/inst/php-5.2.17/man/man1/
page: phpize.1
page: php-config.1
Installing PDO headers:          /opt/phpfarm/inst/php-5.2.17/include/php/ext/pdo/

yay.

check version now ::

$ /opt/phpfarm/inst/php-5.2.17/bin/php -v

PHP 5.2.17 (cli) (built: Sep 24 2014 16:53:53) (DEBUG)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Archive patch for backup (php5.2.17.patch.txt)

Quick DNS Server for Centos 5.10

dns settingI used to use Bind as dns server. The server itself is not for complex task such master or slave dns server. Only for authoritative and local dns cache (optional). As I love copy and paste I often post my experience here at least for my future reference in case I have problem.

Today, my copy and paste method in Centos server (running 5.10) not work anymore. Googling around don’t help either. So I choose other dns software that work for my case. Tinydns is my other choice but I think its time to try something new and I found marands.

Installation process is straightforward and working well, here’s the steps :

 

# yum install gcc

# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-libgcj-multifile –enable-languages=c,c++,objc,obj-c++,java,fortran,ada –enable-java-awt=gtk –disable-dssi –disable-plugin –with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre –with-cpu=generic –host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)

Downloaad latest marands (at the time of writing its 2.0.09)

# wget -c http://maradns.samiam.org/download/2.0/2.0.09/maradns-2.0.09.tar.bz2

# tar xvjf maradns-2.0.09.tar.bz2

# cd maradns-2.0.09
# make
# make install
VERSION=2.0.09 ./build/install.sh
Installing MaraDNS, placing programs in /usr/local//bin/ and /usr/local//sbin/,
man pages in /usr/local//share/man/man1, /usr/local//share/man/man5,
and /usr/local//share/man/man8, and documents in /usr/local//doc/maradns-2.0.09
Adding MaraDNS startup scripts
Starting up MaraDNS at runlevel 3
starting up MaraDNS at runlevel 5

# service maradns start

# chkconfig maradns on

Edit mararc to change bind address, I use 192.168.1.100 as lan address.

# nano /etc/mararc
looking for ipv4_bind_address line and change it into :

ipv4_bind_addresses = “192.168.1.100, 127.0.0.1”

save.

Edit content of zone (db.example.net)

# nano /etc/maradns/db.example.net

Use this lines :

test.example.net.      +14400    soa    ns1.example.net. dns@example.net. 2012010117 14400 3600 604800 14400 ~
example.net.      +14400    ns     ns1.example.net. ~
example.net.      +14400    ns     ns2.example.net. ~
ns1.example.net.  +14400    a      192.168.1.100 ~
ns2.example.net.  +14400    a      192.168.1.100 ~
example.net.      +14400    a      127.0.0.1 ~
www.example.net.  +14400    a      127.0.0.1 ~
example.net.      +14400    mx     10 mail.example.net. ~
test.example.net. +14400    a      192.168.1.100 ~

Save.

restart maradns service

# service maradns restart

dig test ::

Try query dns from other computer that exist on lan.

# dig @192.168.1.100 test.example.net

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.6 <<>> @192.168.1.100 test.example.net
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19886
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.net.        IN    A

;; ANSWER SECTION:
test.example.net.    14400    IN    A    192.168.1.100

;; Query time: 0 msec
;; SERVER: 192.168.1.100#53(192.168.1.100)
;; WHEN: Fri Sep 26 19:41:51 2014
;; MSG SIZE  rcvd: 53

ok.

The rest is change /etc/resolv.conf and add 192.168.1.100 as nameserver.

In case of blocked port 53 :

# iptables -I INPUT -p udp -m udp --dport 53 -j ACCEPT
# service iptables save
# service iptables restart

Install git on CentOS 5.10

New project update need to manually applied to vps server. Since the project use gitlab as source code basis then I need to clone it using git.

Git is not available using yum

# yum install git
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.es.its.nyu.edu
* extras: mirrors.greenmountainaccess.net
* updates: mirrors.rit.edu
base                                                                                                                                             | 1.1 kB     00:00
extras                                                                                                                                           | 2.1 kB     00:00
updates                                                                                                                                          | 1.9 kB     00:00
updates/primary_db                                                                                                                               | 592 kB     00:00
utter-ramblings                                                                                                                                  | 2.3 kB     00:00
Setting up Install Process
No package git available.
Nothing to do

The option is install it via rpmforge repository.
cd /root
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm
yum install gui
—> Package neon.i386 0:0.25.5-10.el5_4.1 set to be updated
—> Package perl-URI.noarch 0:1.35-3 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
git i386 1.7.12.4-1.el5.rf rpmforge 8.1 M
Installing for dependencies:
neon i386 0.25.5-10.el5_4.1 base 101 k
perl-Git i386 1.7.12.4-1.el5.rf rpmforge 86 k
perl-URI noarch 1.35-3 base 116 k
perl-YAML noarch 0.72-1.el5.rf rpmforge 84 k
subversion i386 1.6.11-12.el5_10 updates 3.1 M
subversion-perl i386 1.6.11-12.el5_10 updates 1.0 M

Transaction Summary
========================================================================================================================================================================
Install 7 Package(s)
Upgrade 0 Package(s)

Total download size: 13 M
Is this ok [y/N]: y

# git --version

git version 1.7.12.4

Great ready to clone the gitlab.

How to install FTP Server (pureftp) on CentOS 5.10

Due to backup provider that we use is closing their service I decide to build simple ftp server for this purpose. The problem are I forgot which version of CentOS I use on the server and which ftp server that work well (easy to install).

Solution for 1st problem is using cat.

# cat /etc/redhat-release

CentOS release 5.10 (Final)

Solution for 2nd problem is pureftp.

# yum install pure-ftpd

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.availo.se
* extras: ftp.availo.se
* updates: ftp.availo.se
base                                                                                                                                             | 1.1 kB     00:00
extras                                                                                                                                           | 2.1 kB     00:00
updates                                                                                                                                          | 1.9 kB     00:00
utter-ramblings                                                                                                                                  | 2.3 kB     00:00
Setting up Install Process
No package pure-ftpd available.
Nothing to do

Continue reading