Skip to main content

Installation of PHP-Screw 1.5 with Apache 2.2.6 and PHP-5.2.3

Apache 2.2.6 Installation
[root@myserver src]# pwd
[root@myserver src]# cd httpd-2.2.6
[root@myserver httpd-2.2.6]#

[root@myserver httpd-2.2.6]# ./configure --enable-so --prefix=/usr/local/apache2
[root@myserver httpd-2.2.6]# make
[root@myserver httpd-2.2.6]# make install

PHP-5.2.3 installation
[root@myserver src]# pwd
[root@myserver src]# cd php-5.2.3
[root@myserver php-5.2.3]#

[root@myserver php-5.2.3]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib
[root@myserver php-5.2.3]# make
[root@myserver php-5.2.3]# make install

Configured Apache for PHP 5
# vi /usr/local/apache2/conf/httpd.conf
Added the following 3 lines

LoadModule php5_module modules/
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

PHP Screw Installation
[root@myserver src]# pwd
[root@myserver src]# cd php_screw-1.5
[root@myserver php_screw-1.5]# phpize
[root@myserver php_screw-1.5]# ./configure
[root@myserver php_screw-1.5]# vi my_screw.h

“pm9screw_mycryptkey” with “pm9screw_myownkey” . This is the encryption key that will be used by Screw for encryption

[root@myserver php_screw-1.5]# # make
/bin/sh /usr/local/src/php_screw-1.5/libtool --mode=compile gcc -I. -I/usr/local/src/php_screw-1.5 -DPHP_ATOM_INC -I/usr/local/src/php_screw-1.5/include -I/usr/local/src/php_screw-1.5/main -I/usr/local/src/php_screw-1.5 -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 -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php_screw-1.5/php_screw.c -o php_screw.lo
mkdir .libs
gcc -I. -I/usr/local/src/php_screw-1.5 -DPHP_ATOM_INC -I/usr/local/src/php_screw-1.5/include -I/usr/local/src/php_screw-1.5/main -I/usr/local/src/php_screw-1.5 -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 -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php_screw-1.5/php_screw.c -fPIC -DPIC -o .libs/php_screw.o
/usr/local/src/php_screw-1.5/php_screw.c: In function `pm9screw_ext_fopen':
/usr/local/src/php_screw-1.5/php_screw.c:30: error: `pm9screw_mycryptkey' undeclared (first use in this function)
/usr/local/src/php_screw-1.5/php_screw.c:30: error: (Each undeclared identifier is reported only once
/usr/local/src/php_screw-1.5/php_screw.c:30: error: for each function it appears in.)
make: *** [php_screw.lo] Error 1

Replaced the same “key” in php_screw.c
[root@myserver php_screw-1.5]# sed 's/pm9screw_mycryptkey/ pm9screw_myownkey/g' php_scre.c >
[root@myserver php_screw-1.5]# cat > php_screw.c

[root@myserver php_screw-1.5]# make
Build complete.
Don't forget to run 'make test'.

Copied the Screw Module to Apache modules directory
[root@myserver php_screw-1.5]# cp modules/ /usr/local/apache2/modules/

[root@myserver php_screw-1.5]# vi /usr/local/lib/php.ini

Restarted Apache
[root@myserver php_screw-1.5]# /usr/local/apache2/bin/apachectl restart

Compilation of the encryption tool
[root@myserver php_screw-1.5]# cd tools/
[root@myserver tools]# make
gcc -o screw screw.c zencode.c -lz
screw.c: In function `main':
screw.c:16: error: `' undeclared (first use in this function)
screw.c:16: error: (Each undeclared identifier is reported only once
screw.c:16: error: for each function it appears in.)
make: *** [screw] Error 1

Replacement of encryption key
[root@myserver tools]# vi screw.c

[root@myserver tools]# make
gcc -o screw screw.c zencode.c -lz
[root@myserver tools]#


[root@myserver tools]# ls
Makefile screw screw.c zencode.c

This "screw" is the encryptor

Copied it to a System PATH
[root@myserver tools]# cp screw /usr/local/bin/

Encrypting a PHP script
Please execute the following command.
screw "Path to the PHP script to be encrypted"
The above line creates the script file enciphered by the same name.
Moreover, a backup is created in the same directory by the name of script
file name .screw.

Executing a PHP script.
If the installation of went OK, encrypted PHP scripts can now
be copied to an appropriate directory and executed as if it was
unencrypted. That is: The encryption is transparent for the

[root@myserver tools]# screw /usr/local/apache2/htdocs/phpinfo.php
Success Crypting(/usr/local/apache2/htdocs/phpinfo.php)

Tested the page
# opera localhost/phpinfo.php

Failure. It displays encrypted page.

extension_dir = "./"

extension_dir = "/usr/local/apache2/modules"
in /usr/local/lib/php.ini

Restarted Apache
# /usr/local/bin/apachectl restart

Checked from browser
# opera localhost/phpinfo.php
It woks.fine
Opened a normal PHP file also
# opera localhost/pure_php.php


Popular posts from this blog

Check remote UDP connectivity from Linux

Hi there, You all know how to check TCP port connectivity from a Linux or UNIX machine to a remote machine using telnet as per th example below $ telnet 25 but we can't adopt TELNET to check UDP connectivity. Linux and most of the UNIXes come with a network layer utility called nc (abbreviation for netcat) which is very useful to check UDP connectivity and to explore a lot with both TCP and UDP. An example is shown below # nc -v -u -z -w 3 123 Connection to 123 port [udp/ntp] succeeded!

The best putty package available

Bored of Black screened Task bar filling putty? Issues with porting Saved sessions from machine to machine? Do you like tabbed SSH sessions? Start using portaputty instead of normal putty and link it with puttycm . Puttycm supports sessions to be saved in its own Database files. You can use the Putty sessions you have saved already right inside putty. You can have any number of databases which allow you to arrange Remote servers in folders and convenient namings. I personally recommend creating Database with puttycm rather than using the sessions saved in putty which doesn't offer any option to create folders and saving sessions under that directory tree. You can even save username/password to get it logged automatically and there is an option to pass commands to be run soon after login. I can't recommend this since some bug was found with these options. Portaputty is a variant of putty which stores all the Configuration data in text files instead of MS Window

#!/usr/bin/env bash ## Ping all machines in a Network PING="$(which ping) -c 1 -W 1" echo "Enter Subnet(eg:192.168.0)" read Subnet echo "Do you want to PING the entire network or a RANGE of IPs ? Enter your choice" echo 1. Ping Entire Network echo 2. Ping a RANGE read choice if [ $choice = 1 ]; then { echo Pinging..... for((i=1;i<255;i++)); do ${PING} ${Subnet}.${i} > /dev/null 2> /dev/null if [ $? -eq 0 ]; then echo -e "${Subnet}.${i} is up" fi done } fi if [ $choice = 2 ]; then { echo Enter the Starting IP of Range read a echo Enter the Last IP of Range read b echo Pinging..... for((i=$a;i<$b;i++)); do ${PING} ${Subnet}.${i} > /dev/null 2> /dev/null if [ $? -eq 0 ]; then echo -e "${Subnet}.${i} is up" fi done } fi exit 0