install php and mysql

Updates for php are no longer being installed via yum updates in my server because my operating system Centos 4 can no longer run the most recent repository versions.

I was told I can upgrade to more recent versions of php by using an unsupported repository or compiling a newer version on the system. Also any updates must be manually compiled onto the system.

Can you give me a step by step method for accomplishing this, since I have been applying the yum update command so far?

thanks for your help!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here's a useful link explaining how to compile Apache and PHP from source code.
Just download the php and httpd source code , here are the steps :

cd /usr/src
tar -zxvf php-5.2.17.tar.gz
cd php-5.2.17
./configure  –prefix=/usr –sysconfdir=/etc –with-config-file-path=/etc/ –localstatedir=/var –with-apxs2 –with-openssl –with-zlib –enable-calendar –with-gd –with-jpeg-dir=/usr/lib –with-png-dir=/usr/lib –with-imap –with-imap-ssl –with-kerberos –enable-sysvsem –enable-sysvshm –enable-sockets –with-curl –enable-mbstring –with-mcrypt –with-mysql –with-mysqli –with-gettext –with-freetype-dir –enable-gd-native-ttf

if it complains missing some thing , then you have to install the devel package for the same
eg. mysql-devel , libjpg-devel, libpng-devel etc..

After above step run
make && make install

For Apache
download the apache source :
tar -zxvf httpd-2.2.21.tar.gz
cd httpd-2.2.21
./configure --enable-layout=RedHat --enable-so --with-mpm=prefork --enable-suexec --enable-rewrite --enable-expires --enable-headers --enable-ssl

make && make install

You should now have new php and apache installed.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
netplus21Author Commented:
Thanks for your answers,

I am only interested in compiling a newer version of php and php updates if needed later on. Apache is already installed (version: Apache/2.0.52)

mc10 - Why should I compile PHP as Apache 2 shared module? How can I check to see if the most recent version of PHP is a shared module of Apache 2?

amitnepal - is the ./configure command you gave me the default configure command? If it complains something is missing, and I install the devel package, do I just have to issue the ./configure command again?
yes you have to install the same configure command again. The configure command above includes some basic php modules to be included built in. If you dont want any of them then you can skip .

eg. –with-imap –with-imap-ssl –with-kerberos –enable-sysvsem –enable-sysvshm –enable-sockets –with-curl –enable-mbstring –with-mcrypt –with-mysql –with-mysqli

Lets say you dont want imap support with php ,  you can skip with-imap and with-imap-ssl.

but again even if you skip here, you can compile the invdividual  modules later on and include in php.ini
this url shows how to compile individual php modules.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.