Note: This howto is OUT OF DATE. Please refer to the IUS repository for installing php 5.3x (php53u).

This howto will instruct you how to correctly install php 5.2.x on Official Centos 5.x systems.

Applicable to Centos Versions:

  • Centos 5.x

Requirements

Explanation of requirements.

  1. Root or Sudo access with root privileges.
  2. Internet access.

Doing the Work

Basic description of what will be done and what is expected.

  1. Setup c5-testing:
  2. cd /etc/yum.repos.d && wget http://dev.centos.org/centos/5/CentOS-Testing.repo
  3. Install or update php:
  4. sudo yum --enablerepo=c5-testing install php*
    sudo yum --enablerepo=c5-testing update php*
    
    check to make sure it's been installed/updated:
    rpm -q php
  5. Replace the php.ini:
  6. If you've already had php installed previously (i.e. you used the update method above) then run this command:
    sudo cp /etc/php.ini /etc/php.ini_(todays date) && sudo cp /etc/php.ini.rpmnew /etc/php.ini && sudo service httpd restart
    
    If not then simply restart httpd:
    sudo service httpd restart
    
    create and save a file called phpinfo.php in your httpd docroot with only this in it:
    
    1
    
    <?php phpinfo(); ?>

Troubleshooting / How To Test

Explanation troubleshooting basics and expectations.

  1. Let’s go test and make sure we can see the current php version and other information:
  2. Open a web browser and navigate to: http://www.example.com/phpinfo.php
  3. Make sure httpd is started, also make sure you have correctly replaced the php.ini file if you had previously installed php from official Centos repos.
  4. sudo service httpd status

Common problems and fixes

Describe common problems here, include links to known common problems if on another site

More Information

Any additional information or notes.

Disclaimer

We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #centoshelp on irc.freenode.net

Added Reading

© 2012 CentosHelp.org