How can I upgrade to latest php version?

Posted on 2003-03-09
Medium Priority
Last Modified: 2013-12-13
I installed php while installing RedHat 7.2 And everything is working fine.
But now I want to upgrade php to latest version. I want to enable mysql,apache and Imap while installing php. I downloaded the latest version of php gz.
Do I have to remove the previous php version?
Where should I put this gz file to untar and configure.
If I simply ./configure and make then will it take all the php functions or I have to specifiy the options like mysql, imap and apache.
Question by:konfusion
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

bobsledbob earned 200 total points
ID: 8170094

First off, there's a ton of installation information available at:


Secondly, since you're running PHP as installed by RedHat, you will have an RPM version of PHP.  As root on your machine, do this:

# rpm -qa | grep php

This will show you everything you've got installed relating to PHP.

If you want to compile and install from scratch, you'll want to first remove your PHP package like this:

# rpm -e php

(note, you'll want to remove everything that is returned by the first rpm -qa command.  That is, you might have some other PHP related RPMS installed).

Next, after downloading the PHP source, I tend to like to put my source into:


To unzip and untar:

cd /usr/local/src
mv ~/php-4.3.1.tar.gz .
tar zxvf php-4.3.1.tar.gz


cd php-4.3.1
./configure --with-apxs=/path/to/apache/bin/apxs  --with-imap=/path/to/imap/directory

note, by default, mysql support is automatically installed.  IF however you use MySQL from other places (such as Perl), then you WILL need to include a --with-mysql=/path/to/mysql/directory  otherwise, there will be conflicts when PHP tries to access Mysql

apxs is Apache's module installer, if you didn't know.  this will compile PHP as an apache module and will install it into the appropriate module directory and modify your configuration file so that the module is loaded by apache when needed.

The PHP manual is your friend.

Expert Comment

ID: 9541418
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:

Answered by: bobsledbob

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Independent Software Vendors: 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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

770 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