Category: PHP

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.

del.icio.us proxy v1

April 2, 2008: version 1.1 released.

A little while back, Ian Lloyd mentioned that he could not save links to del.icio.us because the site is blocked at his workplace. So, I wrote a proxy using PHP.

What does it do?

The proxy allows you to save bookmarks to your del.icio.us account without going to the del.icio.us site itself.

So, why is that useful? Say you’re at work and your friendly IT department have decided that de.icio.us is an evil distraction and must be blocked to save the company from going under. You still want to save bookmarks to your del.icio.us account and this is where the proxy comes in.

Once installed, the proxy sits somewhere on your own website – which is hopefully not blocked as well – and waits patiently for you to send it a bookmark. It will save the bookmark to your del.icio.us account for you using an interface kindly provided by the folks at del.icio.us (their API).

So, the proxy saves your bookmarks to your del.icio.us account by proxy, hence its name. Obviously, the del.icio.us service must be available in order to use the proxy.

Download and install

Download del.icio.us proxy

That link also takes you to the installation instructions. The proxy is fairly easy to install, even for people with little PHP knowledge. You just set a few things and upload it to an area of your site.

Once installed, it’s a cinch to use. It’s not been tested extensively in the wild yet, so consider this version a beta release. Having said that, Ian says he’s been using it for a little while with no problems, so I figured I’d finally release it for others to use.

I hope people find it helpful. Enjoy!

Notes

After some initial theatrics with throttling, writing a proxy was quite straightforward. To begin with it seemed that, despite sticking to the API rules about not querying the server too often, querying del.icio.us from my domain had been permanently blocked.

Having discussed my intent and my code with the friendly del.icio.us support team, I’m assured that this shouldn’t be a problem. However, thanks to a tweet from Shiflett, I coded in some extra protection against being throttled.

If you do get throttled by del.icio.us while using the proxy, I suggest you get in touch with del.icio.us directly to sort it out quickly.

Thanks

The proxy uses the PhpDelicious library written by the lovely Ed Eliot. Thanks Ed.

The idea to check for the del.icio.us account’s last update time before posting to it came from Chris Shiflett. Ta Chris.

The inspiration for the proxy in the first place came from Ian Lloyd. Cheers, m’dear.

Updates

April 2, 2008

Version 1.1 released with important fixes.

December 6, 2007

Version 1.0.1 released with annoyance fixes.

Elsewhere