Developing a PHP Website using Visual Studio 2005
Yes it’s possible to use PHP under Visual Studio 2005 and even Visual Studio 2008 IDE. In this tutorial, I will show a walkthrogh how it is possible to develop a classic PHP web application.
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.
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.
Choose install rather than customized to full install the component
After achieving the installation, select new then project.
As you may remark, there is a new node named PHP Projects is added. Click it.
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.
I've already created a folder for this reason, I call it myPhpApplication.
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.
The following window appears.
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:
<META NAME="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<TITLE>My first php application under visual studio</TITLE>
<strong><h1 style="color:White;">Information request</h1></strong>
<form style="background-color:Silver; color:Gray; width: 300px;" method="post">
First name <input type="text" name="FirstName" /><br />
Last name <input type="text" name="LastName" />
<input type="reset" value="Reset" /><input type="submit" value="Submit the request" />
The page will look like this bellow one:
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.
echo("The first name is ". $_POST['FirstName']." and the last name is ". $_POST['LastName']);
Now, run the application and observe.
Click Submit the request.
You can also add a reference to your project; this step is performed to add built in PHP modules.