install/uninstall apche, php, mysql

komputer used Ask the Experts™

i would like to run apache, php and mysql on linux and uninstall all things relevants these installed before and i would like to install again from source code. But i can not uninstall apache because of depandency.

is there anyone who can explain me how i can remove these and install them alltogether?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What distribution are you running ?

To uninstall :

on mandrake/redhat (RPM based distrib) :
rpm -e --force --nodeps Package_To_Uninstall

on debian :
apt-get remove Package_To_Uninstall

on debian :
apt-get install apache
apt-get install php4
and so on...

On rpm based distro :
rpm -ihv package.rpm

You'll find the correct package.rpm for your distro on

Well guiguikun already show you how to uninstall the rpm package of redhat or mandrake, and how to reinstall by rpm.

But you said you wanna to install from the source code, do you mean the tarballs? if yes, do the following

1st you have to download all the updated tarballs from,, and

after that, mysql will be the 1st program you need to install, which is very easy, follow the instrustion inside the source code will do

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS   mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

This will install the mysql by source code.

After that untar both the php and apache here will be a bit complicated, but again instruction still inside the tarballs see below

#   pre-configure Apache for PHP4's configure step
$ cd apache_1.3.x
$ ./configure --prefix=/path/to/apache
$ cd ..

#   configure PHP4 and apply it to the Apache source tree
$ cd ../php-4.x
$ CFLAGS='-O2 -I/path/to/openssl/include'  ./configure --with-apache=../apache_1.3.x --with-mysql=/usr/local/mysql --enable-memory-limit=yes  --enable-debug=no
$ gmake
$ gmake install
$ cd ..

Now php installed with the mysql

#   build/install Apache
$ cd apache_1.3.x
./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a --enable-module=php4
$ make
$ make install

This will install apache with php + mysql, I used the apache 1.3.27 as an example, you can try using apache 2.x also :)

hope this is what you looking for :)
sicne I use mod_ssl so I post the step for mod_ssl the actual install the php4 with apache + mysql as below

#   configure PHP4 and apply it to the Apache source tree
$ cd ../php-4.x
$ ./configure --with-apache=../apache_1.3.x --with-mysql=/usr/local/mysql --enable-memory-limit=yes  --enable-debug=no
$ gmake
$ gmake install
$ cd ..


thank guys,

solved my problem. I uninstall apache, mysql and php by an interface on mandrake 9.1.

guiguikun' s shell command does not work. Linux does not allow to use that to uninstall. So i don't know how i can unstall from console still.

anyway thanks to your responses.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split between paullamhkg and guiguikun
Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial