How to setup a PHP development server

Why you need a development server

When you are going to make your own web applications you need a good development environment.

HTML and JavaScript can run without a development server, but PHP and MySQL do need one, or else you need to upload every little change to your webserver to test your code.

And if you are working on a live website you can break the application by not testing your code on a local machine.

15 steps to install a WAMP or LAMP on your Windows, Mac or Linux machine

In this example, we are going to install AMPPS to create a localhost.

It is completely free and comes with everything included.

MySQL, MongoDB, PHP, Perl, and Python will be installed.

You can easily create MySQL databases and manage them with PhpMyAdmin.

It also comes with Softaculous which can install software such as WordPress and Joomla with one click.

How to install an Ampps development server

  1. Download the latest AMPPS installer from http://www.ampps.com/downloads
  2. Open the installer (as administrator) to start the installation

  1. Click next

  1. Accept the license agreement and click next

  1. Read the information and click next, or directly click next

  1. Select a destination location where Ampps will be installed

  1. Select the Start Menu folder where Ampps will create the program shortcuts

  1. Choose the icons you want, you can leave the default selected options

  1. Review the installation settings and when you are ready, click Install

  1. Click the finish button after the installation wizard has finished the setup

  1. If you don’t have the C++ Redistributable Visual Studio installed, click Yes to install

  1. Check the ‘I agree’ checkbox and click Install to proceed

  1. Once the installer is finished, click the Close button

  1. Click the allow access button on the Windows Defender Firewall popup for mysqld

  1. Also, allow access for the Apache httpd server

Ampps will show a popup with all services running

When you have completed all the above steps you should be able to run PHP scripts on your localhost on http://localhost/.

You can place the scripts in the Ampps www folder, which will be located in the installation folder you selected at the setup.

The default path is something like C:\Program Files (x86)\Ampps\www.

For installing software and scripts with Softaculous, managing databases and other tools you can visit http://localhost/ampps/.

Testing PHP code on your local machine

When we test our code on a local machine, it is fast and almost instant without uploading files to a webserver.

We can save the file and hit the refresh button in our browser to see the result almost instantly.

In this local webserver environment, we can test and edit our code as much as we need without breaking an online application.

When everything is thoroughly tested we can upload our code to the production environment.

Installing a WAMP on localhost or a dedicated machine

With a WAMP (short for Windows, Apache, MySQL, and PHP) installation we are ready for development on our own Windows computer or laptop.

While it is easy to install a WAMP or LAMP on your local computer, you can also choose to install the package on a dedicated computer or server in your network.

If you choose for a dedicated server in your local network it is possible to edit and save from multiple machines which can be very convenient if you have to work with multiple persons on one project.

Another advantage of this type of setup is that it doesn’t affect your work computer performance as the server or computer handles all the tasks. The best workaround depends on your situation and both will work.

Testing in different browsers

Besides a good development setup, you should also have the most used browsers installed on your machine.

To test if applications work correctly, clients expect that you test your websites on all browsers.

Especially HTML and CSS can be displayed differently in the wide array of browsers.

If you want to go one step further you should also have access to a few smartphones and tablets with Android and iOs (although Google Chrome offers a good working device emulator).