Uninstalling make install

Few days ago, I was on such an urge to install php4 side by side with php5 in my PC. I was about to test my code which is apparently not working on php4. Since I don’t have php4 on my localhost, and since asking for space on my office server was somehow not in my option list, I decided to compile php4 from source. I barely know nothing about keeping two version of php in one machine. So luck was all that I was hoping for.

Default installation went smoothly. php worked on console. But there was no ldap support. That was bad since I need ldap support. Reading the configure option was a bit frustating. –with-ldap=blah blah. What to put there? install directory or my ldap directory? I don’t quite remember the story. But i ended up having php4 and php5 in my system, without ldap support. And when i invoke php from cli, I got php 4. OMFG, how am I gonna solve this? It was not just php but also pear. All was invoked implicitly from /usr/local/bin instead of /usr/bin where my php5 resides.

So, I remember, one of my fellow in Technical Support division (halo Aguzz ;) ) once showed me checkinstall. It was basically a tool to add some sort of package management into a tarball installation. After a trivial ./configure and make, we can invoke checkinstall. Checkinstall will then query us for some information to create the package for installation. Checkinstall supports Slackware, RPM and Debian package, so use it wise to suit your OS spec. After finished you’ll already have your tarball installed and a package created for you. You can now, install the package and remove it. This later remove action will caused your previous "make install" get wiped. That’s pretty handy, especially when some developer doesn’t provide a "make uninstall"

Okay, let’s see some console output so you can get a picture of what I’ve done.


[geek@toni php-4.4.2]$ sudo /usr/local/sbin/checkinstall
Password:

checkinstall 1.6.0, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.

The checkinstallrc file was not found at:
/usr/local/lib/checkinstall/checkinstallrc

Assuming default values.

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]:

Preparing package documentation...OK

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R

Please write a description for the package.
End your description with an empty line or EOF.
>> php4-4.4.2 from source, with help of checkinstall
>>

**************************************
**** RPM package creation selected ***
**************************************

This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ php ]

Enter a number to change any of them or press ENTER to continue: 2
Enter new name:
>> php4

This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php4 ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ php ]

Enter a number to change any of them or press ENTER to continue: 11
Enter the additional requirements:
>> php4

This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php4 ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ php4 ]
11 - Provides: [ php ]

Enter a number to change any of them or press ENTER to continue: 10
Enter the provided features:
>>

This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php4 ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ php4 ]
11 - Provides: [ php4 ]

Enter a number to change any of them or press ENTER to continue: 10
Enter the provided features:
>>

This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php4 ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ php4 ]
11 - Provides: [ php4 ]

Enter a number to change any of them or press ENTER to continue: 10
Enter the provided features:
>>
This package will be built according to these values:

1 - Summary: [ php4-4.4.2 from source, with help of checkinstall ]
2 - Name: [ php4 ]
3 - Version: [ 4.4.2 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ php-4.4.2 ]
9 - Alternate source location: [ ]
10 - Requires: [ php4 ]
11 - Provides: [ php4 ]

Enter a number to change any of them or press ENTER to continue:

Installing with make install...

========================= Installation results ===========================
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/local/bin/
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar: bad md5sum for file /usr/local/lib/php/Archive/Tar.php
[PEAR] Console_Getopt: bad md5sum for file /usr/local/lib/php/Console/Getopt.php
[PEAR] HTML_Template_IT: bad md5sum for file /usr/local/lib/php/HTML/Template/IT.php
[PEAR] Net_UserAgent_Detect- already installed: 2.0.1
[PEAR] PEAR - already installed: 1.4.6
Warning! a PEAR user config file already exists from a previous PEAR installation at '/home/geek/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/man/man1/
page: phpize.1
page: php-config.1

======================== Installation successful ==========================

Copying documentation directory...
./
./CREDITS
./INSTALL
./LICENSE
./NEWS
./README.CVS-RULES
./README.EXTENSIONS
./README.EXT_SKEL
./README.PARAMETER_PARSING_API
./README.QNX
./README.SELF-CONTAINED-EXTENSIONS
./README.STREAMS
./README.SUBMITTING_PATCH
./README.TESTING
./README.UNIX-BUILD-SYSTEM
./README.Zeus
./TODO

Copying files to the temporary directory...OK

Striping ELF binaries...OK

Compressing man pages...OK

Building file list...OK

Building RPM package...OK

NOTE: The package will not be installed

Erasing temporary files...OK

Deleting doc-pak directory...OK

Writing backup package...OK

Deleting temp dir...OK

**********************************************************************

Done. The new package has been saved to

/usr/src/redhat/RPMS/i386/php4-4.4.2-1.i386.rpm
You can install it in your system anytime using:

rpm -i php4-4.4.2-1.i386.rpm

**********************************************************************

[geek@toni php-4.4.2]$ sudo rpm -e php4
error: package php4 is not installed
[geek@toni php-4.4.2]$ sudo rpm -ivh /usr/src/redhat/RPMS/i386/php4-4.4.2-1.i386.rpm
Preparing... ########################################### [100%]
1:php4 ########################################### [100%]
[geek@toni php-4.4.2]$ ls /usr/local/bin/
0refresh cvs gnomequran peardev qemu-i386 qemu-system-x86_64 taglib-config
auto.ftpfs cvsbug installwatch pecl qemu-img rcs2log tkcvs
auto.sshfs cvstree lufsd php qemu-mips rox tkdiff
captive-bug-replay distcc lufsd-bin php-config qemu-mipsel soapcpp2 tunesbrowser
captive-cmdline distccd lufsmnt phpize qemu-ppc svn uudeview
cl_demo distccmon-text lufsmount pipemeter qemu-sparc svnadmin uuenview
cl_dlltest gcvs lussh qcset qemu-system-arm svndumpfilter was_php_related/
cl_test gftp minews qemu qemu-system-mips svnlook wmfire
cl_tests gftp-gtk neon-config qemu-arm qemu-system-ppc svnserve wsdl2h
cl_util gftp-text pear qemu-armeb qemu-system-sparc svnversion
[geek@toni php-4.4.2]$ sudo rpm -e php4
[geek@toni php-4.4.2]$ php

[geek@toni php-4.4.2]$ php -v

[geek@toni php-4.4.2]$ php --help
Usage: php [options] [-f] [--] [args...]
php [options] -r [--] [args...]
php [options] [-B ] -R [-E ] [--] [args...]
php [options] [-B ] -F [-E ] [--] [args...]
php [options] -- [args...]

-a Run interactively
-c | Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f Parse .
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-r Run PHP without using script tags
-B Run PHP before processing input lines
-R Run PHP for every input line
-F Parse and execute for every input line
-E Run PHP after processing all input lines
-H Hide any passed arguments from external tools.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z Load Zend extension .

args... Arguments passed to script. Use -- args when first argument
starts with - or script is read from stdin

[geek@toni php-4.4.2]$ php -v
PHP 5.0.4 (cli) (built: Nov 8 2005 08:27:12)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

Die you php4. Die die die!!