RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


SOAP's Alive: Try the New Native SOAP Extensions for PHP : Page 2

With PHP5, Web services and everybody's favorite open source Web development language are now native pals.

Setting Up
Figure 1. Testing PHP: A simple bit of code will let you test out your first PHP page.
If you haven't already done so, download and install PHP5 from the PHP Web site. There you'll find a few downloads to choose from, including the PHP 5.0.2 "zip package" and the PHP 5.0.2 "installer." The easiest path to follow is to download the installer and to install that, as it configures the PHP environment for you. For this article I selected IIS as my Web server, and the installer handled plugging PHP into IIS for me. It also handles several other common web servers including Apache. However the installer distribution doesn't include the SOAP libraries, which have to be downloaded separately.

To get around that, download the PHP zip package , remove the file php_soap.dll, and put it in the C:\PHP\EXT directory. Then edit the PHP.INI file in the WINDOWS directory to make sure that PHP loads the SOAP extensions. To do this, open PHP.INI in notepad or another text editor and find the 'dynamic extensions' area. Underneath this, add the line extension=php_soap.dll. Then, in the 'extensions and directories' section, make sure that the extension_dir setting is 'C:\PHP\EXT' (assuming you installed PHP to C:\PHP).

Figure 2. Full Speed Ahead: The SOAP Extensions are working.
You are now ready to try out PHP, but first it's good to check if the SOAP extensions are working correctly. Create a directory, phptest, in your Web root directory (C:\INETPUB\WWWROOT), and put a simple text file, called myfirst.php in there with the following contents:

Then, using your browser, navigate to http://localhost/phptest/myfirst.php. You should see a page like that in Figure 1.

If you scroll this page down a bit, you should see a section called SOAP. If you don't, you need to go back and check the PHP.INI file again to see if it is loading the extension and that the path is set up correctly. If in doubt, copy all of the extensions from the ZIP file you downloaded earlier to the C:\PHP\EXT directory and you should be good to go. If SOAP is set up correctly, you should see something like that in Figure 2.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date