How to install php 7 and apache on windows 10

(Last Updated On: December 21, 2018)

We hope you installed and setup apache web server on your windows pc, if you’ve followed our previous article then get ready for this one, because in this detailed article you are going to learn that what is php, why you should use php and how one can install php on his/her windows operating system.

So, here we go…

What Is PHP?

PHP stands for HyperText Preprocessor. It is a server-side scripting language used in web frameworks, web content management systems and in web development. Though, it is a scripting language, so it needs a web server like Apache to work. And, in this article we will use apache web server to run php on our windows pc.

Why Use PHP?

For learning, PHP is a simple language. And, it is easily connects with databases like MySQL which is required to develop powerful websites. And, the other merit of using PHP on Apache web server is that we can use our scripts and other learning work with actual no cost. Plus, for a beginner, it is a good pratice to go with PHP for testing and learning before making it live.

How To Install PHP On Your Windows Computer?

Now its time to install PHP, so keep following our steps carefully…

1) Visit php.net and click on downloads

2) Click on “Windows downloads” (because, we want for windows)

3) Now choose ZIP file of latest stable verison of PHP, according to your windows compatibility

4) Download it & Extract the ZIP in a folder

5) Now go to create a folder named PHP in C: drive (Local Disk C)

6) And Paste the extracted files there

7) Now in PHP folder, search for ini files

8) There you will see two ini files ; php.ini-development and php.ini-production

9) Copy the php.ini-development and Paste it in any folder (For Backup)

10) Now rename the file php.ini-development to php.ini (Confirm “Yes“, if any system warning pop-ups)

11) Right click on php.ini and open in Notepad

12) You will see the entire text in php.ini

13) Now find “extension_dir =” (Use Ctrl + F)

14) Replace the line with:

extension_dir = “c:\PHP\ext”

(Remove the prefix semicolon)

[it specifies the ext folder inside the directory in which we installed PHP – c:\PHP]

15) Now again Find “Windows Extensions” & you will get to see all extensions that should be loaded by PHP

16) Since, we need to need activate the two extensions, so we will remove the semicolon before the extensions.

extension=php_gd2.dll … extension=php_mysqli.dll

17) Save the php.ini (Use Ctrl + S)

18) Now we need to add the variable for PHP in system path

19) So, Go to Control Panel > System and Security > System > Advance System Settings

20) Click “Environment Variables

21) Select “Path” from the “System variables” section and click the “Edit” button

22) Now add c:\PHP as the new variable & Click Ok

[For adding a new variable, i am using semicolon ( ; ) for seperating variables]

23) Now if you’ve Apache installed on your computer then, go to C: drive > Apache24 > conf and open the server’s configuration file httpd.conf in Notepad

24) Find “DirectoryIndex” & add index.php in the line or replace the line with below:

< IfModule dir_module >
DirectoryIndex index.html index.php
< /IfModule >

25) Scroll down to the end of the httpd.conf file in Notepad & add the following three lines :

LoadModule php7_module “c:/PHP/php7apache2_4.dll”
AddHandler application/x-httpd-php .php
PHPIniDir “c:/PHP”

26) Save the file & restart your computer (as we changed the variable)

27) After doing it, go to C: drive and open Websites

28) Create a new file in Notepad and add the following lines :

< ?php phpinfo(); ? >

29) Save the file as phpinfo.php

[Note: The file should be in .php format, else it won’t work]

30) Finally, Open any web browser and type localhost/phpinfo.php

31) Hurray!! you successfully installed PHP on your windows computer.

32) Enjoy!! 😊

Conclusion:

So, dear users… It was the complete guide on installing php on windows computer. We hope you got everything about installation of PHP. But, still if you’ve any confusion or issue in installing PHP then please comment here. We will try to sort out.

Finally, keep sharing and keep visiting on Hostkarle for amazing content and service. Bye!!😉

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.