How To Download and Install PHP in Windows 1

How To Download and Install PHP in Windows

PHP

  • PHP is an amazing and popular language!
  • PHP is an acronym for “PHP: Hypertext Preprocessor”
  • PHP is a widely-used, open source scripting language
  • PHP scripts are executed on the server
  • PHP is free to download and use

Features

It is powerful enough to be at the core of the biggest blogging system on the web (WordPress)!
It is deep enough to run the largest social network (Facebook)!
It is also easy enough to be a beginner’s first server side language!

Use of PHP

  • PHP can generate dynamic page content
  • PHP can create, open, read, write, delete, and close files on the server
  • PHP can collect form data
  • PHP can send and receive cookies
  • PHP can add, delete, modify data in your database
  • PHP can be used to control user-access
  • PHP can encrypt data

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP.PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP. PHP 7 is the latest stable release.

PHP 7.0

What’s new in PHP 7

  • PHP 7 is much faster than the previous popular stable release (PHP 5.6)
  • PHP 7 has improved Error Handling
  • PHP 7 supports stricter Type Declarations for function arguments
  • PHP 7 supports new operators (like the spaceship operator: <=> )

Before you continue you should have a basic understanding of the following:

  • HTML
  • CSS
  • JavaScript
  • PHP
How To Download and Install PHP in Windows

Installation [windows]

1) PHP requires the Visual C runtime(CRT). Many applications require that so it may already be installed
PHP 5.5 and 5.6 require VC CRT 11 (Visual Studio 2012). See: https://www.microsoft.com/en-us/download/details.aspx?id=30679
You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. If CRT is already installed, the installer will tell you that and not change anything.


2) https://windows.php.net/download/ prefer to use 7.4, so I downloaded the latest Non-thread-safe 64-bit version of 7.4 downloaded the .zip file version of the VC14 x64 Non Thread Safe edition, under the PHP 7.1 heading.

How To Download and Install PHP in Windows 2

3) Expand the zip file into the path C:\PHP7.

4)Configure PHP to run correctly on your system:

  1. In the C:\PHP7 folder, rename the file php.ini-development to php.ini.
  2. Edit the php.ini file in a text editor visualstudio code – https://code.visualstudio.com/?wt.mc_id=DX_841432 .
  3. Change the following settings in the file and save the file:
    • Change memory_limit from 128M to 1G (because Composer can use lots of memory!)
    • Uncomment the line that reads ; extension_dir = "ext" (remove the ; so the line is just extension_dir = "ext")
How To Download and Install PHP in Windows 3
  • In the section where there are a bunch of extension= lines, uncomment the following line
      1. extension=php_gd2.dll
      2. extension=php_curl.dll
      3. extension=php_mbstring.dll
      4. extension=php_openssl.dll
      5. extension=php_pdo_mysql.dll
      6. extension=php_pdo_sqlite.dll
      7. extension=php_sockets.dll

5) Add C:\PHP7 to your Windows system path:

  1. Open the System Control Panel.
  2. Click ‘Advanced System Settings’.
  3. Click the ‘Environment Variables…’ button.
  4. Click on the Path row under ‘System variables’, and click ‘Edit…’
  5. Click ‘New’ and add the row C:\PHP7.
  6. Click OK, then OK, then OK, and close out of the System Control Panel.

6) Open PowerShell or another terminal emulator (I generally prefer CMD ), and type in php -v to verify PHP is working.

At this point, you should see output like:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\BLUE202> php -v
PHP 7.0.29 (cli) (built: Mar 27 2018 15:23:04) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

This means PHP is working.

Download and Install PHP in Windows is done now you can use example code like this and you can also google for codes.

<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html>

Comment below if you get any problem i will try to solving it.

Also read

Related Posts

Leave a Reply

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