PHP Tutorial Tutorials - Install PHP

Install PHP

Download php for windows

  1. go to download page
    https://windows.php.net/download/

  2. There are a few version to choose.

TS refers to multithread capable builds.
Thread-Safe(TS) - use for single process web servers, like Apache with mod_php.
Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server.
With Apache you have to use the Thread Safe (TS) versions of PHP.

NTS refers to single thread only builds.
Non-Thread-Safe(NTS) - use for IIS and other FastCGI web servers (Apache with mod_fastcgi) and recommended for command-line scripts

Because we use Apache. so download the TS version.

VC14 x64 Thread Safe
Zip [23.28MB] php-7.1.32-Win32-VC14-x64.zip

Install and configure php

  1. Unzip the files and folders in the package zip file.
D:\php-7.1.32-Win32-VC14-x64\dev
D:\php-7.1.32-Win32-VC14-x64\ext
...
D:\php-7.1.32-Win32-VC14-x64\php.exe
...
  1. Copy the file php.ini-development to a new file php.ini
    php.ini is the PHP configure file.
D:\php-7.1.32-Win32-VC14-x64\php.ini
D:\php-7.1.32-Win32-VC14-x64\php.ini-development
D:\php-7.1.32-Win32-VC14-x64\php.ini-production
  1. Configure apache to support PHP scripting file
    Edit the file D:\Apache24\conf\httpd.conf
    load php module:
#LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule php7_module "D:/php-7.1.32-Win32-VC14-x64/php7apache2_4.dll"
PHPIniDir "D:/php-7.1.32-Win32-VC14-x64/php.ini"

add php type:

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

AddType application/x-httpd-php .php

#
# The following lines prevent .

Restart the Apache service

Open a command prompt window, (if you use win10,open it using keyboard WIN+X,Press Windows+X to open the Power Users menu,then choose Command Prompt(Admin)

type:

C:\WINDOWS\system32>cd /d D:\Apache24\bin
D:\Apache24\bin>httpd -k start

OR

C:\WINDOWS\system32>net start apache2.4

Test Installation

  1. Create a new file D:\Apache24\htdocs\index.php
<html>
    <head><title>hello - lautturi.com</title>
    <body>
    <?php
        echo "Hello PHP!";
    ?>
    </body>
</html>
  1. visit it:
    http://localhost/index.php

  2. Create a new file
    D:\Apache24\htdocs\phpinfo.php

<?php
    phpinfo();
?>
  1. visit it using your web browser:
    http://localhost/phpinfo.php
    It will show all php related informations and configurations.

tips: how to download php older version like 5.4 5.6?

https://windows.php.net/downloads/releases/archives/

Date:2019-08-31 02:34:55 From:www.Lautturi.com author:Lautturi