How to install php on windows 10 ?

Learn how to easily install PHP on Windows 10 with step-by-step instructions and start developing dynamic websites and web applications.

How to install php on windows 10 ?

How to Install PHP on Windows 10?

PHP is a popular server-side scripting language that is widely used for web development. If you are using Windows 10 and want to install PHP on your system, follow the steps below:

Step 1: Download PHP

Go to the official PHP website at https://www.php.net/downloads and download the latest version of PHP for Windows. Choose the thread-safe version that matches your system architecture (x86 or x64).

Step 2: Extract the PHP Files

Once the download is complete, extract the contents of the PHP zip file to a folder on your system. You can use a tool like WinRAR or 7-Zip to extract the files.

Step 3: Configure PHP

Next, you need to configure PHP by editing the php.ini file. Locate the php.ini-development file in the PHP folder, make a copy of it, and rename the copy to php.ini.

Open the php.ini file in a text editor and make the following changes:

  • Find the line: ;extension_dir = "ext" and uncomment it by removing the semicolon at the beginning. It should look like: extension_dir = "ext".
  • Find the line: ;extension=openssl and uncomment it by removing the semicolon at the beginning. It should look like: extension=openssl.
  • Save the php.ini file after making the changes.

Step 4: Add PHP to System Path

To run PHP from the command line, you need to add the PHP directory to the system PATH. Here's how to do it:

  1. Right-click on the Start menu and select "System".
  2. Click on "Advanced system settings" on the left side.
  3. In the System Properties window, click on the "Environment Variables" button.
  4. In the System Variables section, select the "Path" variable and click on "Edit".
  5. Click on "New" and add the path to the PHP directory (e.g., C:\php).
  6. Click "OK" to save the changes.

Step 5: Test PHP Installation

Open a command prompt and type php -v to check if PHP is installed correctly. You should see the PHP version information displayed on the screen.

Step 6: Configure PHP for Web Development

If you want to use PHP for web development, you need to configure a web server like Apache or Nginx to work with PHP. Here's how to set up PHP with Apache:

  1. Download and install Apache from https://httpd.apache.org/download.cgi.
  2. Open the Apache configuration file (httpd.conf) located in the conf directory of the Apache installation.
  3. Add the following lines to the end of the file to enable PHP:
    
    LoadModule php_module "C:/php/php7apache2_4.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "C:/php"
    
    

Step 7: Restart Apache

After configuring Apache, restart the Apache server to apply the changes. You can do this by opening a command prompt and typing httpd -k restart.

Step 8: Test PHP with Apache

Create a new PHP file (e.g., index.php) in the Apache htdocs folder.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow