Tuesday, August 17, 2010

PHP "PCNTL" Module Recompilation steps

PHP "PCNTL" Module Recompilation steps :
========================================

Hi,

Please follow the below steps for recompiling "pcntl" Module while exact version of "PCNTL" PHP RPM package not available.

1) Go to PHP Source location

/root/php-5.2.13 or the source path of PHP package.

2) Then navigate to ext directory. This directory having all the php modules.

/root/php-5.2.13/ext/pcntl

3)Then execute "phpize" command in shell . This 'll create the required libries for compilation process.

output
======
[root@admin pcntl]# phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

4)Then Execute the ./configure

[root@admin pcntl]# ./configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable pcntl support... yes, shared
checking for fork... yes
checking for waitpid... yes
checking for sigaction... yes
checking for getpriority... yes
checking for setpriority... yes
checking for wait3... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged

5)[root@admin pcntl]# make

Build complete.
Don't forget to run 'make test'.

6) make test

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP : /usr/local/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.2.13
ZEND_VERSION: 2.2.0
PHP_OS : Linux - Linux admin.website.com.tw 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT 2010 x86_64
INI actual : /root/php-5.2.13/ext/pcntl/tmp-php.ini
More .INIs :
CWD : /root/php-5.2.13/ext/pcntl
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2010-08-18 04:22:01
=====================================================================
PASS Test pcntl wait functionality [tests/001.phpt]
PASS Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
PASS Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
PASS Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
=====================================================================
TIME END 2010-08-18 04:22:03

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 37
---------------------------------------------------------------------

Number of tests : 4 4
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 4 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken : 2 seconds
=====================================================================

We would like to send this report automatically to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose "s" to save the report to
a file that you can send us later.
Do you want to send this report now? [Yns]: y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text):

Posting to qa.php.net /buildtest-process.php

Thank you for helping to make PHP better.

7)Then you can find a file "pcntl.so" under the directory "/usr/lib64/php/modules/"

8)Then go to php source directory "/root/php-5.2.13 " then execute ./ configure command for enabling --enable-pcntl \ module
./ configure --enable-pcntl

./configure --enable-bcmath--enable-calendar--enable-exif--enable-ftp--enable-gd-native-ttf--enable-libxml--enable-magic-quotes--enable-mbstring--enable-sockets--prefix=/usr/local--with-apxs2=/usr/sbin/apxs--with-freetype-dir=/usr--with-gd--with-imap-ssl=/usr--with-jpeg-dir=/usr--with-kerberos--with-libxml-dir=/opt/xml2/--with-mhash=/usr/lib64/--with-curl=/usr/lib64/--with-gettext--with-mcrypt=/opt/libmcrypt/--with-mysql=/usr--with-mysql-sock=/var/lib/mysql/mysql.sock--with-openssl=/usr--with-openssl-dir=/usr--with-png-dir=/usr--with-ttf--with-xpm-dir=/usr/X11R6--with-zlib--with-zlib-dir=/usr--enable-pcntl

Then execute make and make test command.

9) Then add extension entry in php configuration file (php.ini)

vi /etc/php.ini
extension=pcntl.so

10) Restart Apache service

That's it . You can verify the phpmodules by executing the php -m command.

Monday, August 2, 2010

Check with the following things for analyzing server hacks in Linux server

Check with the following things for analyzing server hacks in Linux server
==========================================================================

1)Last command

2)Analyze the following logs
============================
apache error log
apache access log
var/log/messages
apache secure log

3) Verify all the ports

Analyze the following files
============================

/etc/userdomains
/etc/shadow
/etc/passwd
.bash history
/root/bash profile
lsattr