(dv) 3.5:Configure PHP 5 with SOAP

  • This page was last modified on May 10, 2012, at 10:37.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

End of Life Warning

This service has a pending End of Life. Please move to a current service as soon as possible. For more information, please see: (dv) Dedicated-Virtual 4.0: Migration Information.

Contents

This article was provided by dotjay.co.uk. Thanks to Jon Gibbins.

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, FIRST, you’ll need to make sure you’ve installed the (dv) 3.5 Developer Tools. If you're on a (dv) Dedicated-Virtual 4.0 server, the installation instructions are the same. Click here for the updated package list.

Here's how to install the Developer Tools:

  • Go to your AccountCenter, select your domain.
  • Click on Root Access & Developer Tools and hit install.
  • SSH into your server. If you don’t know how to do this, read up on it -- (dv):SSH connection.

Instructions

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

You can find current releases here. I would suggest to use your current version of your PHP installation. The current version (dv) 3.5 is 5.2.6 and for the (dv) 4.0 is 5.3.5.

cd ~
wget http://museum.php.net/php5/php-5.2.6.tar.gz

For the (dv) 4.0, it's:

cd ~
wget http://us3.php.net/get/php-5.3.5.tar.gz/from/us2.php.net/mirror

Decompress the tarball:

(dv) 3.5:

tar -zxf php-5.2.6.tar.gz

(dv) 4.0:

tar -zxf php-5.3.5.tar.gz

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

(dv) 3.5:

cd php-5.2.6
./configure --enable-soap=shared

(dv) 4.0:

cd php-5.3.5
./configure --enable-soap=shared

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

Copy the SOAP module into the existing PHP installation: (dv) 3.5:

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

(dv) 4.0:

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


Add the SOAP module to the PHP configuration:

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

Restart Apache:

/etc/init.d/httpd restart

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

cd ~

(dv) 3.5:

rm -rf php-5.2.6*

(dv) 4.0:

rm -rf php-5.3.5*

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