Support / KnowledgeBase

 
Search the KnowledgeBase Search

Upgrade to PHP5 and MySQL 4.1x on (dv) 2.0 Dedicated Virtual Servers

  • Applies to: (dv) 2.0

  • Difficulty: Medium

  • Time needed: 5 minutes

  • Tools needed: root, ssh, vi

 

This article provides a general walkthrough on how to upgrade to PHP5 and MySQL 4.1x on a (dv) 2.0 Dedicated Virtual Server. If you do not wish to install PHP5 please refer to our MySQL 4.1x article.

This article has the following dependencies:


  • If you currently do not have your root user enabled or our Developer Tools installed please visit the Root Access & Developer Tools section of your AccountCenter
  • We strongly encourage all (dv) 2.0 Customers to migrate to the (dv) 3.5 service where PHP5 and MySQL5 are installed by default.
  • Whenever installing Third-Party software please consult the official documentation. (mt) Media Temple does not support the installation and configuration of software not installed at time of service activation. Please consult our (dv) Scope of Support page for further explanation.
  • mt-example.com is used as an example. Please be sure to replace this text with the proper information for your site or server.

  • TIP:

    Step 1: Make backups

    STOP:

    This point cannot be stressed enough. The best way to back up all of the information on the server so you can return to a previous state is by using our (dv) Backup Add-on service. This way if things don't go well with the upgrade you can always get your server working without too much hassle.

    Step 2: Download the necessary files

    • Log into your server via SSH as the 'root' user and then download the file you need with this command:
      wget http://kb.mediatemple.net/_files/articles/127/php5-upgrade.mt.tar.gz
    • Unpack the file with this command:
      tar xvzf php5-upgrade.mt.tar.gz

    Step 3: Install the packages

    • Move into the php5 directory created in the previous step with this command:
      cd php5
    • Install the packages with this command:
      rpm -Uvh ./*.rpm 
    • If you have previously updated MySQL you may get some error messages about newer packages already being installed. If this is the case just move the rpms that begin with 'MySQL' using this command:
      mv ./mysql* ../
      and retry the installation.

    Step 4: Configure services

    • After the upgrade has finished use SSH to edit the file /etc/my.cnf. Add these two lines under the [MySQLd] section:
      old_passwords=1
      skip-bdb
      
    • The first line prevents you from having to upgrade the MySQL clientprograms, the second keeps MySQLd from trying to start an unsupporteddatabase type.
    • Use this command to fix the privilege tables:
      /usr/bin/mysql_fix_privilege_tables --user=admin --password=`cat /etc/psa/.psa.shadow`
    • Restart MySQL with these two commands to apply the changes made in the previous step are working

      /etc/init.d/mysqld stop
      
      /etc/init.d/mysqld start

    • Use vi to edit the file /etc/httpd/conf.d/php.conf, make sure it's contents look like this:
      LoadModule php5_module modules/libphp5.so
      
      AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml
      
      DirectoryIndex index.php index.php3
    • Fix your php.ini by pasting this line into your shell
       perl -p -i -e 's/\/usr\/lib\/php4/\/usr\/lib\/php\/modules/g' /etc/php.ini
    • Restart Apache to apply the changes:
      /etc/init.d/httpd restart

    Revisions:


    08-05-2008: Fixed a typo in wget line. Thanks Matt.
    05-20-2008: Fixed a typo and added info about article dependencies.
    05-19-2008: Update the URL to the file.

    User Comments

    No visitor comments posted. Post a comment

    Fields marked with an asterisk(*) are required. Comment on this article

    Fill out the form below if you would like to comment on this article.
     
     
     

    (code is not case-sensitive)
     
    Submit
     
     

    Continue