views:

232

answers:

3

I am taking my first foray into PHP programming and need to configure the environment for the first time. Can I use PHP with the built in VS web server or do I need to (and I hope not) use IIS locally?

In addition, any pointers on pitfalls to be avoided would be great.

Many thanks.

Update: I should have made the question more explicit. I am developing a ASP.Net MVC application.

Update 2: It's become clear that I haven't asked the question as cleanly as I would have liked. Here is what I am doing. I have an existing ASP.net MVC application that I am adding an e-mail form to. While researching, I came across this page: Ajax Forms with jQuery and I liked the interface he presented and thought I would try and adapt it. Calls are made to PHP functions and hence my question.

It is also clear that the confusion also could come from the fact that there is a better approach entirely. So, what is the way out of the maze, Alice?

A: 

PHP on IIS is a bit of a pitfall in itself, you can find some reference here: http://stackoverflow.com/questions/10515/php-on-iis

I would sugest using WAMP from here: http://www.apachefriends.org/en/xampp-windows.html

Unkwntech
A: 

I'm using XAMPP on Windows. Works well.

grigy
+1  A: 

For what you're doing, you really shouldn't be using the PHP scripts from that example.

Instead, you should be pulling data from the Form variables posted to the server on your own self-made pages. I don't know the "proper" way to do this using the MVC framework. With the ASP Forms framework, you'd do something like this to handle the POSTed data (example of the sendmail.php file)

string mailTo = Request.Form["emailTo"];
string mailFrom = Request.Form["emailFrom"];
string subject = Request.Form["subject"];
string message = Request.Form["message"];

// Send mail here using variables above
// You'll need an SMTP server and some mail 
// sending code which I'm drawing a blank as
//  to what the name of the classes are at the moment

There is probably a better way to handle this code in the MVC framework, but I haven't worked with it enough to tell you what it is.

Basically, you can't use PHP code at all for an ASP.NET app.

Dan Herbert
lacop
Like lacop said, you could, in theory, use PHP scripts, but they would be essentially stand-alone pages and wouldn't integrate with ASP.NET or Visual Studio at all.
Dan Herbert