Install Zip for PHP on the Grid

Browse by products and services

  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: SSH access


The instructions below will guide you through installing the Zip utility for PHP on your Grid.


This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside (mt) Media Temple's statement of support. Please take a moment to review the Statement of Support.

The following tutorial is provided as a courtesy to our customers to help you configure your Grid. It will be your responsibility to check for important security patches and updates for this extension. You should reinstall or update the extension once updates are available. Otherwise, your server may become vulnerable as your installed software becomes more and more outdated over time.


  • You will need to have SSH access to your Grid to complete the steps in this article. For detailed instructions on how to access your server via SSH, please see the following KnowledgeBase article:
    Connecting via SSH to your server
  • You may also need your site number. For instructions on how to locate this, please see this KnowledgeBase article:
    Server Guide


  1. Log into your Grid with SSH.
  2. Automatically set your site number variable and current PHP path for later use:
    export SITEID=`pwd | awk -F\/ '{ print $3 }'`
    export PHPPATH=`php-latest -i | grep "Configure Command" | perl -pe "s/.*'.\/configure'\s*?'--prefix\=(.*?)'.*/\1/"`
  3. Make the library folder for Zip:
    mkdir -p /home/$SITEID/data/lib/php
  4. Set up a temporary folder for the Zip download:
    mkdir ~/zip
  5. Enter your temporary folder:
    cd ~/zip
  6. Download and decompress the Zip module (you will see a download bar):
    tar -zxvf zip
  7. Move into the zip directory (note: this directory path may change with later versions of zip):
    cd zip-1.10.2/
  8. Install Zip:
    ./configure --with-php-config=$PHPPATH/bin/php-config --enable-zip
  9. Copy the compiled file to the lib folder we created previously:
    cp modules/ /home/$SITEID/data/lib/php/
  10. Now we just need to tell Apache where to find the module. You can add the line of code to your existing php.ini file, or you can copy the sample file first, then add the line.

    If you need to copy the sample php.ini file, run this command (SKIP if you already have one):

    cp -i /home/$SITEID/etc/php.ini.sample /home/$SITEID/etc/php.ini

    Add the necessary directives to your php.ini file:

    echo -e "\n; Zip for PHP 5\nextension_dir=/home/$SITEID/data/lib/php\\n" >> /home/$SITEID/etc/php.ini
    Or, alternatively, open the php.ini file for editing:
    vi /home/$SITEID/etc/php.ini
    vi tip: Press "i" to enter "insert mode" so you can type and copy/paste. Press "Esc" to exit "insert mode" when you are done modifying the file. Type ":wq" to save and quit.

    Add the following lines to your php.ini (be sure to replace 00000 with your site number):

    Filename: php.ini

    ; Zip for PHP 5

That's it! You should now be able to use Zip on your domains that are running PHP. You can test this by viewing your PHP Info page. You should see a section for zip, and zip will also be listed in the "Registered PHP Streams" row.