To Upgrade PHP

This page is out of date! Use How do I install Apache? (Install PhP)
Do this on carson first, make sure it works properly, and then schedule a time to do so on andrews.
  1. Download & untar the most recent version of PHP from http://www.php.net
  2. Get the configure options from the most recent build
    You can get this from the command line PHP interpreter by doing something like

    /usr/local/bin/php -r 'phpinfo();' | grep 'Configure Command'

    and the output should look like

    tmaher@carson:~/proj/trust$ php -r 'phpinfo();' | grep 'Configure Command'
    Configure Command => './configure' '--with-mysql=/usr/local/mysql' '--with-gdbm=/usr/local' '--with-ndbm' '--with-mysqli=/opt/mysql/mysql/bin/mysql_config' '--with-apxs2=/usr/local/apache/bin/apxs'

  3. Run ./configure --with-fries
    Substitute the appropriate options above for the fries. If you need to add support for some new library (like LDAP or Kerberos), this would be the time to do it. Run ./configure --help for a full list of configure-time options.
  4. Run gmake
    Assuming the configure run succeeds, run the GNU Make command to actually build PHP.
  5. Run gmake test
    It should actually prompt you for that. You'll probably get a few test failures, which (sadly) is normal.
  6. Back up the existing version of PHP
    The following files & subdirectories should be backed up somewhere. Judicious use of tar is recommended.

    /usr/local/bin/php*
    /usr/local/lib/php*
    /usr/local/include/php/
    /usr/local/apache/modules/libphp*

  7. Shut down the web server
    Not a restart, but a full-stop.
  8. Install the new PHP
    sudo gmake install should take care of it.
  9. Make sure /usr/local/lib/php.ini looks right
    diff it against the old version and correct as necessary. You did back up the old version like I said above, right?
  10. Restart the web server
    If there are any startup errors, check the logs and debug as necessary. Hold on to the old PHP tar file for a while, in case you have to do an emergency rollback.