# How to uninstall php-5.3.2 which was installed thru tar.bz2



## aurora (Mar 23, 2010)

Hello,

While I was trying to upgrade the PHP-5.2.12 to PHP-5.3.2, I 've used the PHP-5.3.2.tar.bz2 to make it. I know about the section titled "php 5.3.0" in this forum and that I 'd better use the ports collection whenever possible. 

But for the case of PHP-5.3.0, there was simply no port for 5.3.0 (though I 've updated all of my ports recently) and furthermore there were headlines like "Zend's FreeBSD support drop" in the PHP-5.3.0 thread. That's why I attempted to make it by myself.

Now, what I'd like to do is just uninstall the tar.bz2 installation because it interferes with my other attempts to install such as PHP-extensions from ports (/usr/ports/lang/php5-extentions) 

So how do you uninstall that php-5.3.2 which was installed thru tar.bz2  ?

Thanks.


----------



## graudeejs (Mar 23, 2010)

as I understand you downloaded it from php.net


you need to port it to FreeBSD (might need to patch it)

You can't install directly using tools provided by freebsd, otherwise you will face problems later when you will want to remove it


----------



## gilinko (Mar 23, 2010)

aurora72 said:
			
		

> So how do you uninstall that php-5.3.2 which was installed thru tar.bz2  ?
> 
> Thanks.



Unfortunately this is an instance or "you made the mess, you clean it up". As killasmurf86 noted, there is no tool available to de-install something that you have compiled from source yourself without the use of ports. You will have to track down on your own all lib, bin, etc files and do a `# rm` on them. You can probably find something in the source dir from where you installed php-5.3.2 as to where all the files went. There usually is a log that is created upon "make install"


----------



## DutchDaemon (Mar 23, 2010)

There _may_ be a deinstall(-type) option in the tarball's Makefile or configure scripts. Have a browse through them. Or else they may lead you to the directories where files were installed, so you can track down most or all of the installation.


----------



## graudeejs (Mar 23, 2010)

I bet that log is long deleted.
Another option would be to install to some empty dir.
Normally directories should be created....

in this case you can use find to make list of files that were created, then use sed for example to change path, and output to some file

then you could use that file to remove files (for i in `cat file`; do rm -f $i; done)
must be careful


----------



## aurora (Mar 23, 2010)

Thank you for the suggestions,  in my current situation they all make sense. Actually I'm in FreeBSD business for purposes of learning the server administration to be able to correctly administer my Mac OS X server and my Ubuntu laptop (might sound strange, but it works!) and so this attempt to install and upgrade the PHP was a try before appyling it on my Mac OS X (production) server. 

After these remarks, let me return to the subject.

Killasmurf86: Exactly. I've downloaded it from php.net 'cos I had a hard time finding a proper FreeBSD port of it. If I ever manage to uninstall it, I will look for the FreeBSD-ported & patched version of it. 

Installing it into an empty dir looks like good idea, but how do you configure it that way, i.e. which options should I give at the start?

gilinko: Yeah that's right there's no tool for easily removing the installed files, I have to manually find them, it seems. 

DutchDaemon: I've browsed several files including config.log, config.status and Makefile and in Makefile have I found these seemingly meaningful lines:


```
install_targets = install-sapi install-cli install-build 
install-headers install-programs install-pear install-pharcmd 

mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
```

But they don't seem to indicate the location of the installed files. 

There's no deinstall or uninstall option anywhere and make uninstall or deinstall doesn't work either.


----------



## graudeejs (Mar 23, 2010)

aurora72 said:
			
		

> Installing it into an empty dir looks like good idea, but how do you configure it that way, i.e. which options should I give at the start?



usually PREFIX variable is used for this.
It tell where to install files ($PREFIX/bin $PREFIX/man etc)


----------



## aurora (Mar 26, 2010)

I've successfully formed a new PHP installation into an empty folder named /TEMP
and saved all filenames inside /TEMP by:
`# find /TEMP > tempf`

Now as I try to change /TEMP --> /usr/local using sed utility I came across a small problem:

I have to type: 

`# sed 's /\/TEMP/\/usr\/local/ <tempf> temp_new`

but I just cannoy type that ' (straight quote) using the keyboard. I can type tilted quotes such as ` but it doesn't work with sed. (I've typed this message using a Mac not the FreeBSD machine, btw)

How to print ' ? I remember printing special characters in my old Windows machine using the alt+0223 , alt+0228 combination but that doesn't seem to worki with the FreeBSD machine.

Thanks.


----------



## graudeejs (Mar 26, 2010)

use double quote in that case
or open that file in vim and
type
*:%s/\/TEMP/\/usr\/local/*
hit enter
then type
*:wq*

I assume you're not familiar with vim


----------



## aurora (Mar 29, 2010)

I've deleted (via rm) all files and it worked. That's been good in terms of exercising a manual deinstall of a program, which was installed arbitrarly.

Now I look for ways of installing the latest version of PHP (3.x) in a proper manner.

Thanks for the additional guidance on usage of shell scripts, too.


----------

