Apache Php Windows 10

This tutorial shows you two ways of configuring your PHP development environment on the Windows operating system. The first and most convenient way is to install and configure an AMP (Apache, MySQL, PHP) package. This tutorial shows you how to install the XAMPP package. The second way is to install and configure each component separately. Now we have a fully running Apache, MySQL and PHP in our Windows 10 system. Visual Studio Code and PHP Extensions OK, now you need some tooling to develop your PHP applications.

There are a few tips and tricks I found for this installation. Here are the details.

Check Windows Version

Apache

First, here’s the entire Microsoft section on WSL. I highly recommend reading through it.

There are various differences between the latest Windows 10 updates, so this might not work for your version!

I’m on Windows 10 Pro, latest edition as of this writing (July, 2018).

Open a CMD and it will be at the top:

Microsoft Windows [Version 10.0.17134.112]

My current Ubuntu version:

Php

Check IIS is not running

Open Services and disable/stop World Wide Web Publishing Service unless you are going to configure Apache to run on a different port (not included here).

Update Ubuntu

I use the handy icon instead of CMD > Bash for command line. It should work the same.

Add without new repos

Note:I am NOT having Apache autostart and I’d recommend against it if you are using both IIS and Apache.

Open a browser and go to http://localhost

You should see a page that looks like this:

Install PHP 7.2

Add whatever you need.

Add new repos

This may or may not be needed.

Install PHP 7.2
Add whatever you need.

Windows Hosts File

Make a local site (don’t forget: .dev is now a real TLD, so you can’t use it anymore). You will need Admin rights to edit this file. Make sure to save it.

C:WindowsSystem32driversetchosts

Create Windows project folder

Create your project folder. You will creating the VHOST and pointing it to this folder in your Windows file system!

In my case it is:

which translates to

Create Apache VHOST

Unlike in normal Ubuntu world, you need to specify your Windows folder in /etc/apache2.conf. Although you can create a symlink to /var/www, etc., the /var folder actually doesn’t exist.

Update apache2.conf

Add this to the bottom. If you don’t you will get a permissions error in your browser.

Create your new VHOST

Take a look at the configuration. It’s pretty standard. Modify it, or you can use mine below.

Sorry, formatting was lost, but here’s what I ended up with. Note that the default LogLevel has “SSL warn”. Make sure to remove that unless you’ve configured SSL. Also note you’re adding the DocumentRoot again.

Apache Php Windows 10

Enable the site

Add PHPInfo index.php file

2.4

Create an index.php in c:projectssite.local

Now open your browser and go to http://site.local

That’s it!

In this post I’m going to show you how to install and configure the latest versions of PHP 7, Apache 2.4 httpd server, and MySQL 8 on Microsoft Windows 10 operating system.

If you have Windows 7 or Windows 8 you should not have any problem following this instruction.

Go ahead and launch powershell with admin rights, now paste the following code in your powershell and hit enter one by one.

We are going to install chocolatey (a package installer for Windows ) that will let us install PHP and Apache server with two commands on the fly, that will save us time and on behalf of us it will go ahead and configure them as well.

Install Chocolatey

Apache Download For Windows 10

Apache

The second command may take a bit longer depending on your operating system.

Now you will have to relaunch the powershell or the command prompt with admin right. We are going to install PHP, the latest version with command prompt. Chocolatey you will download the latest version of PHP, extract it, install it and set the variable path as well.

Install PHP – Latest

This shouldn’t take a long time. You just wait and watch and once it says installed package one of one. You just need to check the version of PHP that has been installed. simply launcher command prompt and type php -version and hit enter.

There you have it; the latest version of PHP installed and configured for you on the fly.

Similarly we are going to install Apache http server with chocolatey. Launch your powershell/CMD with admin rights.

Install Apache – Latest

You just wait and watch until it finishes the installation. It may take up to 2-3 minutes. After the installation, we need to start the httpd service.

Simply add this following folder path to system variable path and launch your command prompt with admin right.

C:toolsApache24bin

Let’s install the httpd service, Type the following command in the command prompt without admin rights.

Perfect now we need to configure our httpd config file for our PHP files and module. Locate the following httpd.confi file under the following directory and open it with your preferred text editor.

Install Php Apache Windows 10

C:toolsApache24conf

Add the following lines of code at the very bottom of httpd.conf file

#httpd.conf

Now we need to restart the Apache server type the following command in command prompt with admin right to restart the Apache httpd server.

httpd -k restart

You try to load localhost:8080 in your preferred Browser.

Now we need to check if PHP can be read with this Apache server, so create info.php file and type following PHP command and save the file.

#info.php

Pull this URL in your preferred web browser up

Let’s go ahead and install MySQL 8 on Microsoft Windows 10 with chocolatey on the fly. Copy and paste the following command in command prompt with admin rights and hit enter.

Install MySQL – Latest

Once this MySQL is installed with chocolatey you simply have to launch your command prompt and type the following command to access your MySQL server.

Do not type any password, just hit enter and you will be in mysql shell.

Apache 2.4 Install Windows 10

There you have it.. PHP, Apache and MySQL installed and configured on Windows Desktop/server.