Steps to Install PHP on Windows

How to Install PHP on Windows with 3 Simple Steps

PHP is a free and open-source scripting language created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. Various platforms like Windows, Linux, Unix, and macOS support PHP. In this article, you will learn How to Install PHP on Windows. PHP runs on the server and enables admins to create dynamic page content, create and edit files, and more. With the help of simple steps, you will be able to use the Hypertext Preprocessor (PHP) to develop your website. Regardless of the server you are using such as Apache, IIS, etc., PHP is compatible with them and supports most of the databases as a general-purpose scripting language.

It is easy to learn and use the popular PHP language.  While PHP is powerful enough to be used in big blogging systems like WordPress, it is also easy enough to be a beginner’s first server-side language. Join us with this tutorial to review the detailed steps of installing PHP on your Microsoft Windows System. In the end, you will know how to configure PHP on your current in-use web server.

Amazing PHP Capabilities on Windows Server

PHP is free to download and use. As a widely used scripting language, PHP comes with brilliant features. You can use it to run large social networks and execute its scripts on the server. PHP allows you to output more than just HTML. PDF files or photos can be produced. Additionally, you can export any text, including XHTML and XML.

PHP support for numerous databases is one of its best and most important features. Using one of the database-specific extensions, creating a web page with database functionality is very easy. Additionally, PHP may communicate with other services via a wide range of protocols, including HTTP, NNTP, LDAP, IMAP, SNMP, POP3, and COM (on Windows). Moreover, you can use any other protocol to communicate by opening raw network sockets.

PHP installation on your development, you can develop and test websites and applications on a PC without having an impact on the systems or data on your production server.

  • Using PHP, you can do the below tasks free of charge:
  • Generate dynamic page content and Collect form data.
  • Create, read, write, open, close, and delete files.
  • Send/Receive cookies.
  • Add, delete, and change data in the database.
  • Encrypt data.
  • PHP scripts are utilized in three primary areas:
  • Server-side scripting (Websites and web applications)
  • Writing desktop applications (GUI)
  • Command line scripting.

Prerequisites to Install PHP on Windows

Before installing PHP on Windows, be aware that PHP needs at least Windows Vista or 2008 installed. 32- or 64-bit. Windows RT/WOA/ARM is not compatible with PHP. Windows 2008 and Vista are no longer supported as of PHP 7.2.0.

Then, make sure that your system is meeting below specifications:

  • Visual C runtime. (CRT)
  • A Server running Windows VPS.
  • Administrative access to your machine.
  • Web server software such as Apache or Nginx, etc.

Visual Guide to Install PHP in Windows

PHP drives everything from your blog to the most well-known websites on the internet. It is quick, adaptable, and practical. Let’s go through the easy steps of this guide, learn How to Install PHP on Windows, and review the way of configuring and using PHP on Windows. Using the instructions in this content, you can Install PHP on Windows 10 and Windows 11.

Step 1. Download PHP

  • Firstly, open your favorite web browser to visit the main PHP website and click on Downloads.

Download PHP

  • To have PHP installed on your Windows, click on the Windows ”Downloads” button.

PHP Windows Download

  • Select the Thread-safe version from the several options on the new webpage by clicking the zip button and downloading it.

PHP Thread safe version

In this way, you can successfully download and install PHP in Windows. As you reviewed, PHP download for Windows 10 is easy. In the next step, you will see what to do with the downloaded PHP zip file. Stay with us.

Step 2. Configure PHP on Windows

  • At this point, you must look for the zipped file in your system’s downloads and extract it.

Extract downloaded PHP file

  • You receive the extracted folder upon extraction. Then, copy the folder that was extracted.

Copy the extracted PHP folder

  • Now, paste the copy folder into the Program files folder on your Windows system.

Paste the extracted PHP folder

  • Once the Permission Windows appears, click on ”Continue” to let it paste the folder in program files.

Permission Windows

  • Copy the folder’s address in the program files after pasting the folder.

 Copy the address of PHP folder

Step 3. Start Using PHP on Windows

  • To use PHP on Windows, search for “Edit the system environment variables” in the Start Menu and select it to launch.

How to use PHP on Windows

  • When the System window opens, select “Environment Variables” from the Variable New window.

Select Environment Variables…

  • Select the Path option under “System variables” and double-click it.

System variables

  • Click the “New” button when the below screen appears.

Click the New button

  • Then, paste the address you copied from the program files to the new and hit enter. When you are finished, click on the OK button.

Paste Your PHP location Address

  • Once you see the below windows, click on the OK button.

Environment Variables Settings

  • You are so close to completing the steps to Install PHP on Windows 10. To save the changes, click OK.

Finish Environment Variables Settings

  • PHP is now installed on your machine. You may verify by typing Command Prompt into the “Start” menu.
  • Open it.

Using cmd to test and start PHP

  • Enter php -v when the Command Prompt appears.

Check PHP Version

  • To see the version of PHP that is installed on your computer, enter the command prompt

PHP successfull installation on Windows

The above output shows that you have successfully installed PHP on your Windows system.

What to do After Installing PHP on Windows?

So far, we tried to present simple steps to Install PHP on Windows. If you’re a beginner in PHP programming, and you don’t know what a PHP file is, continue reading this final part of this tutorial to be aware of the different ways you can run PHP files.

PHP files can be run in two different ways. PHP scripts can be executed directly from your browser when you run them within a web server such as Apache, Nginx, or IIS. This is the recommended method of running PHP files. This is how all PHP websites operate! Alternatively, you can use the command line to execute PHP programs without having to set up a web server. Generally, you must use the web server configuration if you wish to publish your PHP pages online. However, PHP scripts can also be executed from the command line, which is helpful for standard chores. These are often executed by the PHP command without the need for a web server and are set up to run in the background as jobs.

A lot of PHP scripts and apps these days have built-in commands for a variety of tasks, such as installing software, importing and exporting database entities, cleaning the cache, and more. One of the most widely used programs designed for the PHP command line is Composer, a dependency management for the language you may be familiar with.

A lot of PHP scripts and apps these days have built-in commands for a variety of tasks, such as installing software, importing and exporting database entities, cleaning the cache, and more. One of the most widely used programs designed for the PHP command line is Composer, a dependency management for the language that you may be familiar with.

Also, you can Install and Use Xampp on Windows to design and develop your website with the help of PHP language.

How to Use CLI to Run a PHP File on Windows

PHP programmers must comprehend how the command-line PHP interface functions. Many PHP frameworks and applications these days include an integrated command-line utility (CLI) that lets you handle a variety of utility functions right from the CLI.

You should know where the PHP executable file is located in your PHP installation if you plan to launch PHP scripts using the command line. On Windows, the php.exe file should be located in the directory where your PHP installation is located. All you have to do is enter the name of the PHP file you wish to run from the command-line interface, once you know where your PHP executable file is located.

However, to start a PHP script as a Windows user, you must enter the entire path to the PHP executable. You can use the PHP executable, which is often located at C:\php8\php.exe, to run the PHP file as demonstrated by the following command.

C:\php\php.exe my_example.php

Conclusion

In this article, you learned How to Install and run PHP on Windows 10. You also reviewed the easy steps of configuring and using PHP on Windows. You must configure it with one of the web servers that supports PHP scripts to run them from a web server. One of the most widely used web servers for Windows is IIS. However, popular web servers for other operating systems are Nginx and Apache. The good news is that when you log in to your new server, the majority of hosting companies will already have a web server configured with PHP.

If you follow the instructions, you will be able to install PHP on PC without any issues, but please do not hesitate to contact us if you encounter any difficulties. Our technical support team will try their best to solve your problems.

Leave a Reply

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


salim.P Publish in December 10, 2023 at 7:57 am

What to do if my server does not support PHP

    Ashley Publish in December 10, 2023 at 8:08 am

    While setting up PHP on your system, if your server does not support PHP, you need to install a web server first and then install PHP. Finally, install a database such as MySQL and if you need help, refer to PHP Installation and Configuration guide and follow the related instructions.