Developing a PHP Website using Visual Studio 2005


Yes it's possible to use PHP under Visual Studio 2005 and even 2008 IDE; in this tutorial I will discuss how to build a PHP based Website using Visual Studio 2005 in a step by step walk through tutorial. 

Walkthrough:

First, you must install the visual PHP for visual studio witch is a share ware component that compose visual studio 2005, it is downloadable from the site http://www.jcxsoftware.com/vs.php web site, also, there is a version proposed for visual studio 2008. As a second step, you have to install it. The wizard will guide you until achieve the installation.

Figure 1

Figure 2

Figure 3

Choose install rather than customized to full install the component

Figure 4

Figure 5

After achieving the installation, select new then project.

Figure 6

As you may remark, there is a new node named PHP Projects is added. Click it.

Figure 7

Don't forget to name your project, so give your project a name in the text box then click OK. After that, a window appears and you are invited to select a folder within it the project will be created.

Figure 8

I've already created a folder for this reason, I call it myPhpApplication.

Figure 9

You can start now and enjoy your time by developing a PHP application under visual studio. To add a new item you have only to right click on the project node in the solution explorer and add a HTML, a PHP page or even a PHP class. To add more additional items, select the new item menu.

Figure 10

The following window appears.

Figure 11

Then you can select your item from within the list view.

Ok, let's start by developing a very simple and classic PHP application, a client side witch is an HTML page that sends via post method the first name and the last name of a given session user to a PHP application, the last one publishes those two received data.

This is the client script side bellow. So create a new HTML page and copy and past it into the code zone:

<HTML>
          <HEAD>
                   <META NAME="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
                   <TITLE>My first php application under visual studio</TITLE>
          </HEAD>
          <BODY style="background-color:Gray;">
          <center>
          <strong><h1 style="color:White;">Information request</h1></strong>
          <form style="background-color:Silver; color:Gray; width: 300px;"  method="post">
          <br />
          First name <input type="text" name="FirstName" /><br />
          Last name <input type="text" name="LastName" />
          <br />
          <br />
          <input type="reset" value="Reset" /><input type="submit" value="Submit the request" />
          <br />
          </form>
          </center>
          </BODY>

</
HTML>

The page will look like this bellow one:



Figure 12

Now let's perform the server side. First, add a PHP page into the project then paste this script server in the server code zone.

<?php

echo("The first name is ". $_POST['FirstName']." and the last name is ". $_POST['LastName']);

?>

Now, run the application and observe.

Figure 13

Click Submit the request.



Figure 14

You can also add a reference to your project; this step is performed to add built in PHP modules.

Figure 15

Good dotneting!!!
 

Up Next
    Ebook Download
    View all
    Learn
    View all