install php and mysql

Posted on 2011-10-13
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
    LVL 1

    Expert Comment

    Here's a useful link explaining how to compile Apache and PHP from source code.
    LVL 7

    Accepted Solution

    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.


    Author Comment

    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?
    LVL 7

    Expert Comment

    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    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 …

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now