What's the best way to develop locally using PHP and Visual Studio?

I'm taking my first foray into PHP programming and need to set up your environment for the first time. Can I use PHP with the VS Embedded Web Server, or do I need (and hopefully not) use IIS locally?

Also, any pointers to pitfalls to avoid would be great.

Many thanks.

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

Update 2: It became clear that I did not ask the question as cleanly as I would like. That's what I'm doing. I have an existing ASP.net MVC application to which I am adding an email form. While researching, I came across this page: Ajax Forms with jQuery , and I liked the interface it presented and thought I'd try to adapt it. The calls are made to PHP functions and hence my question.

It is also clear that confusion can also arise from the fact that there is a better approach. So what's the way out of the maze, Alice?

0


source to share


3 answers


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

Instead, you should retrieve data from server-hosted form variables in your own pages. I don't know the "correct" way to do this using the MVC framework. With ASP Forms framework, you would do something like this to handle POSTed data (example 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 an MVC environment, but I haven't worked with it enough to tell you what it is.

Basically, you cannot use PHP code at all for an ASP.NET application.

+1


source


PHP on IIS is a bit on its own, you can find some links here: What do I need to run PHP applications on IIS?



I would like to use WAMP here: http://www.apachefriends.org/en/xampp-windows.html

0


source


I am using XAMPP on Windows. Works well.

0


source







All Articles