03 Local Php Home

03 Local Php Home

Technique 1

Interestingly, PHP supports a built-in server as of PHP 5.4. This would be an easy way to debug code, but as you might expect, it's limited and not meant to be used for a public server. You aren't able to run anything more than one single-threaded process, but as of PHP 7.4, you can test multiple concurrent requests. This part of the built-in server is not available on Windows, though.

Technique 2

XAMPP is what I tried to install on my computer when we were manually configuring PHP, but I don't even use it anymore, so I don't think there was any point in that. Anyways, the acronym today is recursive with X standing for XAMPP, but it used to stand for cross-platform. The rest of the letters deal with the software you would expect to run alongside PHP, and you can toggle everything on and off in the app, and I don't think there are any extra steps.

Technique 3

IIS is what we use for production at work, and I also think that's what I'm actually running on my computer. It is only available on Windows, but the interface allows for a lot more control over your server, and you can configure it to match production. Since it is a Windows-based product, it can also be used to host ASP.NET. However if you don't need to test something too in-depth, there's a chance you could run into a lot more 500 errors than with the other options.

Summary

Pros:

  • You can have a version of your site specifically configured to not submit any actual data.
  • It's just easier to pick up and continue working with a project.
  • localhost doesn't fall in the private IP ranges, so it's technically a good way to test public IP configurations.

Cons:

  • Moving the exact same code over to a server can lead to a lot more issues needing fixing.
  • Cloning the production server to set up a dev server is an easier way to map configurations.
  • You may forget to apply certain php.ini configurations.