Configuring PHP 5 with SOAP on Media Temple dv 3.5

I recently upgraded to a dv 3.5 from Media Temple for a project, but found that PHP was not configured with the SOAP extension needed for the site. With some help from the lovely Media Temple support people, here’s what I did to get it working without having to completely reinstall PHP.

Disclaimer: These instructions worked for me on a dv 3.5; it may not work for other dv packages.

Checking your current PHP installation

You can use phpinfo() to check your PHP installation and see whether or not the extension you need is already installed. If it’s not listed, it’s worth checking the PHP documentation to see how it suggests installing it. In my case, the SOAP extension is only available if PHP was configured with the –enable-soap option.

Getting SOAPy!

You will need to compile the SOAP shared module and add it to the existing PHP configuration. To do this, you’ll need to make sure you’ve installed the dv 3.5 Developer Tools. To do this, go to your Account Center, select your domain, find Root Access & Developer Tools and hit install.

Open up a terminal and SSH into your server. If you don’t know how to do this, read up on getting SSH access to your server.

  1. You’ll need to grab the latest PHP source code. Download it to somewhere convenient, like the home directory:

    cd ~

    wget http://php.net/get/php-5.2.5.tar.gz/from/us.php.net/mirror

  2. Decompress the tarball:

    tar -zxf php-5.2.5.tar.gz

  3. Move into the source directory and configure PHP with SOAP enabled (this may take a few minutes):

    cd php-5.2.5

    ./configure –enable-soap=shared

  4. Run the build (again, this may take a few minutes):

    make

    When that’s done, you can optionally test the build, which threw errors for me, but it all worked nonetheless:

    make test

  5. Copy the SOAP module into the existing PHP installation:

    cp modules/soap.so /usr/lib/php/modules/

  6. Add the SOAP module to the PHP configuration:

    echo “extension=soap.so” > /etc/php.d/soap.ini

  7. Restart Apache:

    /etc/init.d/httpd restart

  8. Tidy up by deleting the files we downloaded, e.g.:

    cd ~

    rm -rf php-5.2.5*

The SOAP module should now be loaded and ready to rock; you can check using phpinfo() again.