Skip to content

Commit

Permalink
Rework Windows install and configuration section (#3795)
Browse files Browse the repository at this point in the history
This moves things around to make it more binary-install-forward like the Unix/macOS documentation, and generally cleans it all up to read better.
  • Loading branch information
jimwins authored Sep 30, 2024
1 parent 398329d commit 2dbf3d9
Show file tree
Hide file tree
Showing 11 changed files with 227 additions and 246 deletions.
29 changes: 28 additions & 1 deletion faq/installation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ cgi error:
<qandaentry xml:id="faq.installation.phprc">
<question>
<para>
How do I make the &php.ini; file available to PHP on windows?
How do I make the &php.ini; file available to PHP on Windows?
</para>
</question>
<answer>
Expand All @@ -471,6 +471,33 @@ cgi error:
</answer>
</qandaentry>

<qandaentry xml:id="faq.installation.windows-temporary-path">
<question>
<simpara>
Windows: How do I verify that PHP can write to the temporary directory
under IIS?
</simpara>
</question>
<answer>
<procedure>
<step>
<simpara>
Right-click the temporary directory (<varname>%TEMP%</varname>)
in File Explorer to get the permissions.
The temporary directory is available from the configuration or
<function>phpinfo</function>.
</simpara>
</step>
<step>
<simpara>
For IIS, check that user <literal>IIS_User</literal> has
<literal>MODIFY</literal> permission.
</simpara>
</step>
</procedure>
</answer>
</qandaentry>

<qandaentry xml:id="faq.installation.apache.multiviews">
<question>
<para>
Expand Down
2 changes: 0 additions & 2 deletions install/cloud/azure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

<para>As such, PHP and extensions will run on Azure App Services just as they will on other Windows servers.

Much of the knowledgebase is also portable, so see the <link linkend="install.windows.troubleshooting">Windows Troubleshooting Page</link> too.

However, the management interface for Azure App Services is different:
</para>

Expand Down
14 changes: 10 additions & 4 deletions install/windows/apache2.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="install.windows.apache2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Apache 2.x on Microsoft Windows</title>
<title>Installation for Apache 2.x on Windows systems</title>
<para>
This section contains notes and hints specific to Apache 2.x installs
of PHP on Microsoft Windows systems.
Expand Down Expand Up @@ -39,6 +39,12 @@

<sect2 xml:id="install.windows.apache2.module">
<title>Installing as an Apache handler</title>
<note>
<simpara>
When using the apache2handler SAPI, the Thread Safe (TS) version of
PHP must be used.
</simpara>
</note>
<para>
To load the PHP module for Apache 2.x, the following lines in the
Apache &httpd.conf; configuration file must be inserted:
Expand Down Expand Up @@ -115,15 +121,15 @@ PHPIniDir "C:/php"
Install the module according to the instructions that will come with it.
</para>
<para>
Configure your web server as shown below, taking care to adjust any paths
to reflect how you have installed things on your particular system:
Configure the web server as shown below, taking care to adjust any paths
to reflect how it is installed on the system:

<example>
<title>Configure Apache to run PHP as FastCGI</title>
<programlisting>
<![CDATA[
LoadModule fcgid_module modules/mod_fcgid.so
# Where is your php.ini file?
# Where is the php.ini file?
FcgidInitialEnv PHPRC "c:/php"
<FilesMatch \.php$>
SetHandler fcgid-script
Expand Down
13 changes: 4 additions & 9 deletions install/windows/building.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
<!-- $Revision$ -->
<sect1 xml:id="install.windows.building" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Building from source</title>
<para>
This chapter teaches how to compile PHP from sources on Windows, using
Microsoft's tools. To compile PHP with cygwin, please refer to <xref
linkend="install.unix"/>.
</para>
<para>
See the Wiki documentation at:
<link xlink:href="&url.wiki.windows.build.howto;">&url.wiki.windows.build.howto;</link>
</para>
<simpara>
See the <link xlink:href="&url.install.windows.stepbystep;">step-by-step
build instructions</link> for building with Visual Studio.
</simpara>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
20 changes: 10 additions & 10 deletions install/windows/commandline.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="install.windows.commandline" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Command Line PHP on Microsoft Windows</title>
<title>Running PHP on the command line on Windows systems</title>
<para>
This section contains notes and hints specific to getting PHP running
from the command line for Windows.
</para>
<note>
<para>
You should read the <link linkend="install.windows.manual">manual
Read the <link linkend="install.windows.manual">manual
installation steps</link> first!
</para>
</note>
Expand Down Expand Up @@ -41,9 +41,9 @@ C:\php\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3
<para>
Append the location of the PHP executable (<filename>php.exe</filename>,
<filename>php-win.exe</filename> or <filename>php-cli.exe</filename>
depending upon your PHP version and display preferences) to the
depending upon the PHP version and display preferences) to the
<envar>PATH</envar> environment variable. Read more about how to
add your PHP directory to <envar>PATH</envar> in the <link
add the appropriate directory to <envar>PATH</envar> in the <link
linkend="faq.installation.addtopath">corresponding FAQ entry</link>.
</para>
</listitem>
Expand All @@ -59,10 +59,10 @@ C:\php\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3
<envar>PATH</envar> environment variable.
<note>
<para>
The position in which you place the <literal>.PHP</literal> will
The position in which the <literal>.PHP</literal> is placed will
determine which script or program is executed when there are matching
filenames. For example, placing <literal>.PHP</literal> before
<literal>.BAT</literal> will cause your script to run, rather than
<literal>.BAT</literal> will cause the script to run, rather than
the batch file, if there is a batch file with the same name.
</para>
</note>
Expand Down Expand Up @@ -143,7 +143,7 @@ Windows Registry Editor Version 5.00
"C:\PHP Scripts\script" -arg1 -arg2 -arg3
]]>
</screen>
or, if your <literal>"C:\PHP Scripts"</literal> path is in the
or, if the <literal>"C:\PHP Scripts"</literal> directory is in the
<envar>PATH</envar> environment variable:
<screen>
<![CDATA[
Expand All @@ -154,7 +154,7 @@ script -arg1 -arg2 -arg3

<note>
<para>
There is a small problem if you intend to use this technique and use your
There is a small problem when intending to use this technique to run
PHP scripts as a command line filter, like the example below:
<screen>
<![CDATA[
Expand All @@ -167,8 +167,8 @@ dir | "C:\PHP Scripts\script" -arg1 -arg2 -arg3
dir | script -arg1 -arg2 -arg3
]]>
</screen>
You may find that the script simply hangs and nothing is output.
To get this operational, you need to make another registry change.
The script may simply hang and nothing is output.
To get this operational, another registry change needs to be made:
<screen>
<![CDATA[
Windows Registry Editor Version 5.00
Expand Down
91 changes: 91 additions & 0 deletions install/windows/iis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="install.windows.iis" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Installation with IIS for Windows</title>

<simplesect>
<title>Installing IIS</title>
<simpara>
Internet Information Services (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 <link xlink:href="https://docs.microsoft.com/en-us/previous-versions/ms181052(v=vs.80)">detailed instructions for enabling IIS</link>.
For development,
<link xlink:href="https://www.microsoft.com/en-us/download/details.aspx?id=48264">IIS/Express</link> can also be used.
</simpara>
<note>
<simpara>
The Non-Thread Safe (NTS) version of PHP should be installed when using
the FastCGI handler with IIS.
</simpara>
</note>
</simplesect>
<simplesect>
<title>Configuring PHP with IIS</title>

<simpara>
In IIS Manager, Install FastCGI module and add a handler mapping for
<literal>.php</literal> to the path to <filename>php-cgi.exe</filename>
(not <filename>php.exe</filename>)
</simpara>

<simpara>
The <command>APPCMD</command> command line tool can be used to script
IIS configuration.
</simpara>
</simplesect>
<simplesect>
<title>Example batch script</title>
<example>
<title>Command line to configure IIS and PHP</title>
<programlisting>
<![CDATA[
@echo off
REM download .ZIP file of PHP build from http://windows.php.net/downloads/
REM path to directory into which PHP .ZIP file was decompressed (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']"
]]>
</programlisting>
</example>
</simplesect>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
87 changes: 16 additions & 71 deletions install/windows/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,30 @@
<!-- $Revision$ -->
<chapter xml:id="install.windows" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Installation on Windows systems</title>
<para>
Installing PHP on modern Microsoft Windows systems and recommended configuration with common web servers.
</para>

<para>
The Official releases of PHP on Windows are recommended for production use.
However, you are welcome to build PHP from Source.
You will need a Visual Studio environment.
See <link xlink:href="&url.install.windows.stepbystep;">Step by Step Build Instructions</link>.
</para>
<para>
<itemizedlist spacing="compact">
<listitem>
<para>
<link linkend="install.windows.commandline">Using PHP on Windows Command line</link>
</para>
</listitem>
<listitem>
<para>
<link linkend="install.cloud.azure">Installing PHP on Azure App Services</link>
(aka Microsoft Azure, Windows Azure, or (Windows) Azure Web Apps).
</para>
</listitem>
</itemizedlist>
</para>
<simpara>
The official releases of PHP on Windows are recommended for production use,
but PHP can also be <link linkend="install.windows.building">built from source</link>.
</simpara>

<sect1 xml:id="install.windows.requirements">
<title>Install Requirements</title>
<simpara>
PHP can also be <link linkend="install.cloud.azure">installed on Azure App Services</link>
(aka Microsoft Azure, Windows Azure, or (Windows) Azure Web Apps).
</simpara>

<para>
PHP requires at least Windows 2008/Vista.
Either 32-Bit or 64-bit (<acronym>AKA</acronym> 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.
As of PHP 8.3.0, Windows 2008 R2 and Windows 7 are no longer supported.
</para>
<simpara>
The <link linkend="faq.installation">Installation section of the
frequently asked questions</link> covers common installation and
configuration issues that may be encountered.
</simpara>

<para>
PHP requires the Visual C runtime (CRT). Many applications require that so it may already be installed.
</para>

<para>
The Microsoft Visual C++ Redistributable for Visual Studio 2022 is suitable
for all these PHP versions, see
<link xlink:href="&url.microsoft.visualc.redistr;">https://visualstudio.microsoft.com/downloads/</link>.
</para>

<para>
You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds.
</para>

<para>
If CRT is already installed, the installer will tell you that and not change anything.
</para>

<para>
The CRT installer supports the <option>/quiet</option> and <option>/norestart</option>
command-line switches, so you can script running it.
</para>
</sect1>

<sect1 xml:id="install.windows.pecl">
<title>PECL</title>
<para>
PECL extensions are pre-built for Windows and available from:
<link xlink:href="http://windows.php.net/downloads/pecl/releases/">http://windows.php.net/downloads/pecl/releases/</link>
</para>
<para>
Some extensions use features specific to some Unix systems and so are not available on Windows.
Otherwise, all extensions are available for Windows.
</para>
</sect1>

&install.windows.tools;
&install.windows.recommended;
&install.windows.manual;
&install.windows.apache2;
&install.windows.iis;
&install.windows.tools;
&install.windows.building;
&install.windows.commandline;
&install.windows.apache2;
&install.windows.troubleshooting;
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
Loading

0 comments on commit 2dbf3d9

Please sign in to comment.