PHP

Install PHP on Modern Windows Systems

Install Requirements

PHP 5.5+ require at least Windows 2008/Vista, or 2008r2, 2012, 2012r2, 2016 or 7, 8, 8.1, 10. Either 32-Bit or 64-bit (aka X86 or X64. PHP does not run on Windows RT/WOA/ARM). As of PHP 7.2.0 Windows 2008 and Vista are no longer supported.

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

PHP 7.0 and 7.1 require VC CRT 14 (Visual Studio 2015). PHP 7.2, 7.3 and 7.4 require VC CRT 15 (Visual Studio 2017). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see » https://visualstudio.microsoft.com/downloads/.

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. The CRT installer supports the /quiet and /norestart command-line switches, so you can script running it.
VC11 CRT DLLs can be copied from your local machine to a remote machine(a `Copy Deployment` installation) instead of running the installer on the remote machine (such as a web server you have restricted access to).
VC14 CRT does not support a `Copy Deployment` installation. VC14 CRT has many more DLLs(most in files with names starting with api-*). If you can find them all and copy them, it will also work (try a tool like Resource Hacker to get a list of all the DLLs to copy).

PECL ¶

PECL extensions are pre-built for Windows and available from: » http://windows.php.net/downloads/pecl/releases/

Some extensions use features specific to some Unix systems and so are not available on Windows. Otherwise, all extensions are available for Windows.

PHP Installer Tools on Windows ¶

PHP Install Tools

If you want to setup PHP and are using IIS, the easiest way is to use » Microsoft’s Web Platform Installer (WebPI).

» XAMPP, WampServer and BitNami will setup PHP applications for use with Apache on Windows.

Recommended Configuration on Windows systems ¶

OpCache

Highly Recommended that you enable OpCache. This extension is included with PHP for Windows. It compiles and optimizes PHP scripts and caches them in memory so that they aren’t compiled every time the page is loaded.

In your php.ini, set

Example #1 Recommended OpCache configuration

zend_extension=php_opcache.dll opcache.enable=On opcache.enable_cli=On 

And restart your web server. For more info, see: OpCache Configuration

WinCache

Recommended that you use WinCache if using IIS, especially if in a shared web hosting environment or using networked file storage (NAS). All PHP Applications automatically benefit from WinCache’s file cache feature. File system operations are cached in memory. WinCache also can cache user objects in memory and share them between php.exe or php-cgi.exe processes (share objects between requests). Many major web applications have a plugin or extension or configuration option to make use of the WinCache user object cache. If you need high performance, you should use the object cache in your applications. See: » http://pecl.php.net/package/WinCache to download a WinCache DLL (or tgz) to your PHP extensions directory (extensions_dir in your php.ini). In your php.ini, set

Example #2 Recommended WinCache configuration

extension=php_wincache.dll wincache.fcenabled=1 wincache.ocenabled=1 ; removed as of wincache 2.0.0.0 

For more info, see: » http://php.net/manual/en/wincache.configuration.php

IIS Configuration

In IIS Manager, Install FastCGI module and add a handler mapping for `.php` to the path to PHP-CGI.exe (not PHP.exe)

You may use the APPCMD command line tool to script IIS configuration.

Database

You’ll probably need a Database Server. Popular databases provide PHP extensions to use them. If your web site doesn’t get a lot of traffic, you can run your database server on the same server as your web server. Many popular database servers run on Windows.

PHP includes mysqli and pdo_mysql extensions. PHP 5.5 and 5.6 include mysql extension (deprecated in 7.0). See » https://dev.mysql.com/downloads/windows/

Leave a Reply

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