Php and windows and installer

Install PHP on Windows

Prerequisite and running on your Windows system, else you will not be able to run PHP Scripts.

Alternatively, you can install WAMP server or AMPPS server to install PHP, MySQL, and Apache Web Server on your Windows machine.

Options for installing PHP on Windows

  • You can install php on windows manually.
  • You can run the .msi package, i.e. windows installer for php to install php.
  • Besides full installation, you can install php extensions on an existing installation of PHP.
  • You can upgrade to a higher version of PHP from an existing version.

Install PHP on Windows manually

You have to download zipped binary version of PHP from http://www.php.net/downloads.php.

Extract the downloaded file to php folder which must be created at the root of any of your windows drives (e.g. c:\php or d:\php).

Enter php folder and rename the file php.ini-recommonded to php.ini.

Open the file php.ini with any text editor and find extension_dir within the file.

Change the extension directory, i.e. if you have installed php in php folder of D drive, setting will be extension_dir=D:\php.

Now you open Environment Variables (MyComputer -> System Properties -> Environment Variables), under system variables, select Path and click Edit,
in the Variable value, go to the end of the list and put a semicolon, then add D:\php;D:\php\ext assuming D:\php is the location of your php installation.

Then Click on New under system variable and add PHPRC against Variable name and D:\php against Variable value.

Install PHP on Windows using Windows installer

Simply run the .msi Windows installer file and follow the installation wizard.

Читайте также:  Название страницы

Testing if PHP is installed properly

Create a php file containing code and save it as test.php.
Run this file on your web server and if you get an output like this:

install PHP on Windows

then you have installed PHP properly.

Install PHP extensions on Windows

What is a PHP extension?

A PHP extension is a piece of code which is not part of the core PHP and you need it to explore certain functionalities of PHP (e.g. for using mysql you need mysql extension of PHP).

Many extensions are available out of the box in the PHP installer downloaded from php.net or in the .msi package. But many need to be obtained separately from php.net.

In Windows, extensions come in the form of a .dll file which you can download from php.net.

How do you configure an extension on Windows?

You need to change the setting of extension dir in php.ini file. For example, If you are using PHP 5.0.3, and you have installed php in c:\php, then you have to set extension_dir = C:\php\ext in your php.ini file.

After downloading the files needed, you have to open php.ini and enable a line pointing to an extension in question.

For enabling extensions, you have to uncomment a line in your php.ini file. For example, for enabling mysql extension, you have to change; extension = php_mysql.dll to extension = php_mysql.dll in your php.ini file.

You also need to restart your web server and php in order to complete the installation of a specific extension.

Sample php.ini

Previous: PHP Home
Next: Install php on Linux

Follow us on Facebook and Twitter for latest update.

Источник

Php and windows and installer

IIS is built in to Windows. On Windows Server, the IIS role can be added via the Server Manager. The CGI Role Feature needs to be included. On Windows Desktop, IIS has to be added via the Control Panel’s Add/Remove Programs. The Microsoft documentation has » detailed instructions. For desktop web apps and web-development, IIS/Express or PHP Desktop can also be used.

Читайте также:  Editor

Example #1 Command line to configure IIS and PHP

@echo off REM download .ZIP file of PHP build from http://windows.php.net/downloads/ REM path to directory you decompressed PHP .ZIP file into (no trailing \) set phppath=c:\php REM Clear current PHP handlers %windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI REM The following command will generate an error message if PHP is not installed. This can be ignored. %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI'] REM Set up the PHP handler %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='%phppath%\php-cgi.exe'] %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phppath%\php-cgi.exe',resourceType='Unspecified'] %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script REM Configure FastCGI Variables %windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='%phppath%\php-cgi.exe'].instanceMaxRequests:10000 %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phppath%\php.ini']"

Apache

There are several builds of Apache2 for Windows. The Apache builds of ApacheLounge are recommended, but other options include XAMPP, WampServer and BitNami, which provide automatic installer tools. PHP can be used on Apache through mod_php or mod_fastcgi. mod_php requires a TS build of Apache built with same version of Visual C and same CPU (x86 or x64).

Choose Build

Windows builds can be downloaded from » http://windows.php.net/download/. All builds are optimized ( PGO ), and QA and GA releases are thoroughly tested.

  • Thread-Safe(TS) — for single process web servers, like Apache with mod_php
  • Non-Thread-Safe(NTS) — for IIS and other FastCGI web servers (Apache with mod_fastcgi) and recommended for command-line scripts
  • x86 — for 32-bits systems.
  • x64 — for 64-bits systems.

Источник

PHP: Hypertext Preprocessor

This site is dedicated to supporting PHP on Microsoft Windows. It also supports ports of PHP extensions or features as well as providing special builds for the various Windows architectures. If you like to build your own PHP binaries, instructions can be found on the Wiki.

Читайте также:  Runtime reflection in java

PECL For Windows

PECL extensions for Windows is being worked on. Windows DLL can be downloaded right from the PECL website.

The PECL extension release and snapshot build directories are browsable directly.

Which version do I choose?

IIS

Apache

Please use the Apache builds provided by Apache Lounge. They provide VC15 and VS16 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs. With Apache, using the apache2handler SAPI, you have to use the Thread Safe (TS) versions of PHP.

VC15 & VS16

More recent versions of PHP are built with VC15 or VS16 (Visual Studio 2017 or 2019 compiler respectively) and include improvements in performance and stability. — The VC15 and VS16 builds require to have the Visual C++ Redistributable for Visual Studio 2015-2019 x64 or x86 installed

TS and NTS

TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).

What is PGO?

amd64 (x86_64) Builds

PHP 7 provides full 64-bit support. The x64 builds of PHP 7 support native 64-bit integers, LFS, 64-bit memory_limit and much more.

x64 builds are recommended (almost all Windows installations support x64).

Long and multibyte path

PHP 7.1+ supports long and UTF-8 paths. See the manual for details.

Archives

Past releases are available from our archives, older versions not found there can be found at the Museum.

Источник

Оцените статью