install php and mysql

Posted on 2011-10-13
Medium Priority
Last Modified: 2012-06-27
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!
Question by:netplus21
  • 2

Expert Comment

ID: 36963327
Here's a useful link explaining how to compile Apache and PHP from source code.

Accepted Solution

amitnepal earned 2000 total points
ID: 36963488
Just download the php and httpd source code , here are the steps :

cd /usr/src
wget http://us2.php.net/get/php-5.2.17.tar.gz/from/this/mirror
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 :
wget http://www.motorlogy.com/apache//httpd/httpd-2.2.21.tar.gz
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.


Author Comment

ID: 36975809
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?

Expert Comment

ID: 36976104
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.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question