New Stuff

How To Install PHP Or XAMP In Windows 10/8.1/8

how to install php in windows

Welcome to the Introduction to PHP series. In the last article, I talked about what PHP is and it works. But PHP is not preinstalled on any operating system whether it’s Windows, Linux or Mac. In this article, I’ll show you how to install PHP in Windows 10/8.1/8.

As I mentioned in my last article that PHP is not preinstalled on any operating systems. If you’re learning web development then you will need to make PHP environment to be able to run PHP and see the output in the browser.

PHP And Required Packages

Web server

PHP is an open source programming language so you can download and install it. But it’s all to be able to see PHP output in the browser. If you just install PHP and write some PHP code, open it in the browser, then the code won’t execute. You’ll see the code as you typed in the code editor. Besides PHP we also need a web server. Now don’t think of a web server as a super computer with terabytes of installed memory. Here a web server is a simple program that sits on your computer and listens to the HTTP requests and based on those requests, web server processes information and sends the output to the user browser.

So we also need a web server.

Database system

Nowadays in almost all modern web applications, you’ve database. With database, we can build amazing functionalities in our web applications. For example, sign up or sign in functionality is very common. You can create this functionality with a database by creating user records and saving user credentials in those records.

Not just the sign up or sign in, if you use twitter, facebook or any other social networking site today, every function you use is based on database system, likes, comments, tweets, and retweets etc.

One of the most popular database programming languages is Mysql. It’s not hard to learn Mysql. It’s very simple to talk to database in mysql. For example, if you want to insert a record in a database table, the query for this would be –

INSERT INTO user SET username = 'sohail', email = '[email protected]', password = 'pass34342432';

where user is a table and username, email, and password are table column -

Even if you don’t install a database system, you’ll still be able to see your PHP code working. But, you will not be able to create a lot of modern web app functionalities without a database system.

Install PHP, Apache, and Mysql Or XAMPP

You can either download all these packages individually by downloading from their official websites and compile them to install or you can download all of them or even more just by download single package such as XAMPP.

XAMPP stands for X – cross platform, A – Apache(web server), M – Mysql(database language), P – PHP or P – Perl.

Download XAMPP For Windows 10/8/8.1/7

You can download XAMPP from the official website.

xampp official website

  • Click XAMPP for Windows.

And that’s it. The download will start.

After you have downloaded XAMPP, double click the .exe file and run the setup. It’s very. Simply keep pressing next and select couple of options and it’s done.

You’ll be asked to select the packages that you want to install.

select xampp packages

You can uncheck Perl because it’s a different language and you won’t need it when you’re learning PHP.

select xampp installation directory

Now select the directory where you want to install XAMPP. It’s very important. XAMPP is the directory which will contain all your future projects. So select a safe place where it’s not likely to delete. XAMPP folder has all your PHP files such as PHP configuration file ‘php.ini’ etc.

After you have selected the installation directory, click next and finish. Now the installation will start.

xampp is installing

When the installation is finished, you’ll be prompted to close installer and start the XAMPP control panel.

do you want to start the xampp control panel

XAMPP Control Panel

xampp control panel

So take a deep breath now. You can see that there are five software and each option to start, config and check logs. I’ve talked the first two software already. Apache is a popular web server, MySQL is a database system.

To start Apache server, and MySQL server, simply click start.

After starting the server, to check everything is working perfect, open web browser and type in ‘localhost’.

xampp localhost

If you see the above web page, it means everything is working and you’re ready to start writing PHP.

Create PHP example page

To create a project, go to XAMPP >> htdocs. Now here you can create a folder and contain project files in it.

create php project in htdocs

Create test.php file and write some PHP code.

php example code

Result in web browser –

localhost/example/test.php

php example page

Conclusion

And it’s all. You’ve successfully created PHP environment. You can start your first PHP project and write some PHP. In the next article, I’ll talk about the best code editors for PHP. A good code editor speed up programming and enhance your programming skills.

Comments
To Top