Enhancing PHP Programming with the ASP.NET AJAX Framework - Download and set up PHP and the related web server
(Page 3 of 4 )
As is explained on the home page of PHP for Microsoft AJAX Library, we have to install PHP 5.2 or higher and make sure we have the php-json module installed. In fact, the home page has also provided the download address for the php-json module (http://www.aurore.net/projects/php-json/). Moreover, on the home page, Steve announced that he had tested the project under both IIS7 (Vista) and Apache (Ubuntu 6.06 + PHP 5.2) environments.
Fortunately, in recent years, PHP and Apache web server have both been developing rapidly and have now released their formal and steady versions-PHP 5.25 and Apache 2.28. Therefore, what you need to do is just download the two and make corresponding installations according to your own operation systems. Everything should go smoothly.
Since my test environment is Windows XP professional + Visual Studio 2005 + ASP.NET AJAX + IIS 5.1 (shipped within Windows XP), the first thing that comes to mind is to test PHP for Microsoft AJAX Library project on IIS 5.1. Regrettably, I downloaded and tried PHP 5.20, PHP 5.23, and PHP 5.25 and tested the two shipped samples (even including some other limited samples found on the Internet) on IIS 5.1 again and again; I failed every time with similar fault prompts, as shown in Figure 2.
Figure 2-the sample projects failed when tested on IIS 5.1
_html_m7f106bc6.png)
For now, I've concluded that IIS 5.1 leads to the 'strange' error-the version is so low that it results in the error message shown in Figure 2. However, I am sorry not to have given the test result with a higher version of IIS because I was low on time. Therefore, readers who have installed higher versions of IIS can continue with the test.
Finally, I had to resort to the open source Apache 2.2.6-actually, everything goes smoothly!
If you install PHP 5.20, you also have to download the related php-json module, because the project will use the JSON technique to transfer data between the client side and the PHP server side. On the other hand, PHP 5.23 and PHP 5.25 have all provided built-in support for JSON (i.e. not with independent forms of extension modules any more). Therefore, it's better to utilize the higher versions of PHP.
Next, let's turn to another task-download Microsoft AJAX Library.
Download Microsoft AJAX Library
This step is pretty easy. What you need to do is open your browser and navigate to http://www.asp.net/ajax/downloads/. Figure 3 gives the related download snapshot.
Figure 3-download Microsoft AJAX Library
_html_m657eefee.png)
In reality, when you download the package, you will find that the script files are practically the same as those shipped with ASP.NET 2.0 AJAX Extensions.
Now, with all of our prerequisites taken care of, let's delve into a concrete sample that leverages PHP to the Microsoft AJAX Library in order to add Ajax features to the current PHP project. This sample application will retrieve animal information asynchronously from the PHP server side via a simulated web service.
Next: Use PHP class to define web service >>
More ASP.NET Articles
More By Xianzhong Zhu