major rewrite of the build process on windows.

- cygwin is optional
- rewording and ues of entities for urls


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@113343 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Friedhelm Betz 2003-01-24 20:36:23 +00:00
parent 35d54dc69c
commit d60bb1d0d2

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.22 $ -->
<!-- $Revision: 1.23 $ -->
<sect1 id="install.windows">
<title>Installation on Windows systems</title>
<para>
@ -357,159 +357,207 @@
"Why is building on Windows so hard?" Two reasons come to mind:
</para>
<orderedlist>
<listitem><simpara>
Windows does not (yet) enjoy a large community of developers
who are willing to freely share their source. As a direct
result, the necessary investment in infrastructure required
to support such development hasn't been made. By and large,
what is available has been made possible by the porting of
necessary utilities from Unix. Don't be surprised if some of
this heritage shows through from time to time.
</simpara></listitem>
<listitem><simpara>
Pretty much all of the instructions that follow are of the
"set and forget" variety. So sit back and try follow the
instructions below as faithfully as you can.
</simpara></listitem>
<listitem>
<simpara>
Windows does not (yet) enjoy a large community of developers
who are willing to freely share their source. As a direct
result, the necessary investment in infrastructure required
to support such development hasn't been made. By and large,
what is available has been made possible by the porting of
necessary utilities from Unix. Don't be surprised if some of
this heritage shows through from time to time.
</simpara>
</listitem>
<listitem>
<simpara>
Pretty much all of the instructions that follow are of the
"set and forget" variety. So sit back and try follow the
instructions below as faithfully as you can.
</simpara>
</listitem>
</orderedlist>
<sect3 id="install.windows.build.prepare">
<title>Preparations</title>
<sect3 id="install.windows.build.requirement">
&reftitle.required;
<para>
Before you get started, you have a lot to download...
To compile and build <literal>PHP</literal> you need a Microsoft
Development Environment. Microsoft Visuaul C++ 6.0 is recommended.
To extract the downloaded files you need a extraction utilitiy
(e.g.: Winzip). If you don't already have an unzip utility, you
can get a free version from <ulink url="&url.infozip;">InfoZip</ulink>.
</para>
<itemizedlist>
<listitem><simpara>
For starters, get the Cygwin toolkit from the closest <ulink
url="http://sources.redhat.com/cygwin/download.html">cygwin</ulink>
mirror site. This will provide you most of the popular GNU
utilities used by the build process.
</simpara></listitem>
<listitem><simpara>
Download the rest of the build tools you will need from the PHP
site at <ulink url="http://www.php.net/extra/win32build.zip"
>http://www.php.net/extra/win32build.zip</ulink>.
</simpara></listitem>
<listitem><simpara>
Get the source code for the DNS name resolver used by PHP
at <ulink url="http://www.php.net/extra/bindlib_w32.zip"
>http://www.php.net/extra/bindlib_w32.zip</ulink>. This
is a replacement for the <filename>resolv.lib</filename>
library included in <filename>win32build.zip</filename>.
</simpara></listitem>
<listitem><simpara>
If you don't already have an unzip utility, you will
need one. A free version is available from <ulink
url="http://www.cdrom.com/pub/infozip/UnZip.html">InfoZip</ulink>.
</simpara></listitem>
<listitem><simpara>If you plan to compile PHP as a static Apache
module you will also need the
<ulink url="http://httpd.apache.org/dist/httpd/">Apache sources</ulink>
of your version of Apache.
</simpara></listitem>
<para>
Before you get started, you have to download...
</para>
<itemizedlist>
<listitem>
<simpara>
..the win32 buildtools from the <literal>PHP</literal> site
at <ulink url="&url.win32.buildtools;">&url.win32.buildtools;</ulink>.
</simpara>
</listitem>
<listitem>
<simpara>
..the source code for the DNS name resolver used by <literal>PHP
</literal> from <ulink url="&url.win32.dnsresolver;">
&url.win32.dnsresolver;</ulink>. This is a replacement for the
<filename>resolv.lib</filename> library included in <filename>
win32build.zip</filename>.
</simpara>
</listitem>
<listitem>
<simpara>
If you plan to compile <literal>PHP</literal> as a Apache
module you will also need the <ulink url="&url.apache.source;">Apache
sources</ulink>.
</simpara>
</listitem>
</itemizedlist>
<simpara>
Finally, you are going to need the source to PHP 4 itself.
You can get the latest development version using <ulink
url="http://www.php.net/anoncvs.php">anonymous CVS</ulink>. If you get
a <ulink url="http://snaps.php.net/">snapshot</ulink> or a <ulink
url="http://www.php.net/downloads.php">source</ulink> tarball, you
not only will have to untar and ungzip it, but you will have to
convert the bare linefeeds to crlf's in the <filename>*.dsp</filename>
and <filename>*.dsw</filename> files before Microsoft Visual C++
will have anything to do with them.
Finally, you are going to need the source to PHP 4 itself. You can get
the latest development version using <ulink url="&url.php.anoncvs;">
anonymous CVS</ulink>, a <ulink url="&url.php.snapshots;">
snapshot</ulink> or the most recent released <ulink url="&url.php.downloads;">
source</ulink> tarball.
</simpara>
</sect3>
<sect3 id="install.windows.build.install">
<title>Putting it all together</title>
<para>
After downloading the required packages you have to extract them in a
proper place.
<itemizedlist>
<listitem>
<simpara>
Create a working directory where all files end up after extracting, e.g:
<filename>c:\work</filename>.
</simpara>
</listitem>
<listitem>
<simpara>
Create the directory <filename>win32build</filename> under your
working directory (<filename>c:\work</filename>) and unzip <filename>
win32build.zip</filename> into it.
</simpara>
</listitem>
<listitem>
<simpara>
Create the directory <filename>bindlib_w32</filename> under your
working directory (<filename>c:\work</filename>) and unzip <filename>
bindlib_w32.zip</filename> into it.
</simpara>
</listitem>
<listitem>
<simpara>
Extract the downloaded PHP source code into your working directory
(<filename>c:\work</filename>).
</simpara>
</listitem>
</itemizedlist>
Following this steps your directory structure looks like this:
<informalexample>
<programlisting>
<![CDATA[
+--c:\work
| |
| +--bindlib_w32
| | |
| | +--arpa
| | |
| | +--conf
| | |
| | +--...
| |
| +--php-4.x.x
| | |
| | +--build
| | |
| | +--...
| | |
| | +--win32
| | |
| | +--...
| |
| +--win32build
| | |
| | +--bin
| | |
| | +--include
| | |
| | +--lib
]]>
</programlisting>
</informalexample>
Create the directories <filename>c:\usr\local\lib</filename>. Copy
<filename>bison.simple</filename> from <filename>c:\work\win32build\bin
</filename> to <filename>c:\usr\local\lib</filename>.
</para>
<note>
<simpara>
Place the <filename>Zend</filename> and
<filename>TSRM</filename> directories inside the
<filename>php4</filename> directory in order for the projects
to be found during the build process.
<ulink url="&url.cygwin;">Cygwin</ulink> users may omit the last
step. A properly installed Cygwin environment provides the mandatory
files <filename>bison.simple</filename> and
<filename>bison.exe</filename>.
</simpara>
</note>
</sect3>
<sect3 id="install.windows.build.install">
<title>Putting it all together</title>
<itemizedlist>
<listitem><simpara>
Follow the instructions for installing the unzip utility of
your choosing.
</simpara>
</listitem>
<listitem>
<simpara>
Execute <filename>setup.exe</filename> and follow the installation
instructions. If you choose to install to a path other than
<filename>c:\cygnus</filename>, let the build process know by setting
the Cygwin environment variable. On Windows 95/98 setting
an environment variable can be done by placing a line in
your <filename>autoexec.bat</filename>. On Windows NT, go to My
Computer =&gt; Control Panel =&gt; System and select the
environment tab.
</simpara>
</listitem>
</itemizedlist>
<warning>
<simpara>
Make a temporary directory for Cygwin to use, otherwise many
commands (particularly bison) will fail. On Windows 95/98,
<userinput>mkdir C:\TMP</userinput>. For Windows NT,
<userinput>mkdir %SystemDrive%\tmp</userinput>.
</simpara>
</warning>
<sect3 id="install.windows.build.configure">
<title>Configure MVC ++</title>
<para>
The next step is to configure MVC ++ to prepare for compiling.
Launch Microsoft Visual C++, and from the menu select
Tools =&gt; Options. In the dialog, select the
directories tab. Sequentially change the dropdown
to Executables, Includes, and Library files. Your entries should look
like this:
<itemizedlist>
<listitem>
<simpara>
Make a directory and unzip <filename>win32build.zip</filename> into it.
</simpara></listitem>
<listitem>
<simpara>
Launch Microsoft Visual C++, and from the menu select
Tools =&gt; Options. In the dialog, select the
directories tab. Sequentially change the dropdown
to Executables, Includes, and Library files,
and ensure that <filename>cygwin\bin</filename>,
<filename>win32build\include</filename>, and
<filename>win32build\lib</filename> are in each list,
respectively. (To add an entry, select a blank line
at the end of the list and begin typing). Typical entries
will look like this:
</simpara>
<itemizedlist>
<listitem><simpara>
<filename>c:\cygnus\bin</filename>
</simpara></listitem>
<listitem><simpara>
<filename>c:\php-win32build\include</filename>
</simpara></listitem>
<listitem><simpara>
<filename>c:\php-win32build\lib</filename>
</simpara></listitem>
</itemizedlist>
<simpara>
Press OK, and exit out of Visual C++.
</simpara>
</listitem>
<listitem>
<simpara>
Make another directory and unzip <filename>bindlib_w32.zip</filename>
into it. Decide whether you want to have debug symbols available
(bindlib - Win32 Debug) or not (bindlib - Win32 Release).
Build the appropriate configuration:
</simpara>
<itemizedlist>
<listitem><simpara>
For GUI users, launch VC++, and then select File =&gt; Open
Workspace and select bindlib. Then select Build=&gt;Set
Active Configuration and select the desired configuration.
Finally select Build=&gt;Rebuild All.
</simpara></listitem>
<listitem>
<simpara>
For command line users, make sure that you either have
the C++ environment variables registered, or have run
<command>vcvars.bat</command>, and then execute one of the
following:
Executable files: <filename>c:\work\win32build\bin</filename>,
Cygwin users: <filename>cygwin\bin</filename>
</simpara>
</listitem>
<listitem>
<simpara>
Include files: <filename>c:\work\win32build\include</filename>
</simpara>
</listitem>
<listitem>
<simpara>
Library files: <filename>c:\work\win32build\lib</filename>
</simpara>
</listitem>
</itemizedlist>
</para>
</sect3>
<sect3 id="install.windows.build.resolvlib">
<title>Build resolv.lib</title>
<para>
You must build the <filename>resolv.lib</filename> library.
Decide whether you want to have debug symbols available
(bindlib - Win32 Debug) or not (bindlib - Win32 Release).
Build the appropriate configuration:
<itemizedlist>
<listitem>
<simpara>
For GUI users, launch VC++, and then select File =&gt; Open
Workspace, navigate to <filename>c:\work\bindlib_w32</filename>and
select <filename>bindlib.dsw</filename>. Then select Build=&gt;Set
Active Configuration and select the desired configuration.
Finally select Build=&gt;Rebuild All.
</simpara>
</listitem>
<listitem>
<simpara>
For command line users, make sure that you either have the C++
environment variables registered, or have run
<command>vcvars.bat</command>, and then execute one of the following
commands:
</simpara>
<itemizedlist>
<listitem>
@ -524,63 +572,88 @@
</listitem>
</itemizedlist>
</listitem>
<listitem><simpara>
At this point, you should have a usable
<filename>resolv.lib</filename> in either your
<filename>Debug</filename> or <filename>Release</filename>
subdirectories. Copy this file into your
<filename>win32build\lib</filename> directory over the
file by the same name found in there.
</simpara></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
At this point, you should have a usable <filename>resolv.lib</filename>
in either your <filename>c:\work\bindlib_w32\Debug</filename> or
<filename>Release</filename> subdirectories. Copy this file into your
<filename>c:\work\win32build\lib</filename> directory over the file
by the same name found in there.
</para>
</sect3>
<sect3 id="install.windows.build.compile">
<title>Compiling</title>
<simpara>
The best way to get started is to build the standalone/CGI version.
The best way to get started is to build the CGI version.
</simpara>
<itemizedlist>
<listitem><simpara>
For GUI users, launch VC++, and then select File =&gt; Open
Workspace and select php4ts. Then select Build=&gt;Set Active
Configuration and select the desired configuration. Finally
select Build=&gt;Rebuild All.
</simpara></listitem>
<listitem>
<simpara>
For GUI users, launch VC++, and then select File =&gt; Open
Workspace and select <filename>c:\work\php-4.x.x\win32\php4ts.dsw
</filename>. Then select Build=&gt;Set Active
Configuration and select the desired configuration, either
<literal>php4ts - Win32 Debug_TS</literal> or
<literal>php4ts - Win32 Release_TS</literal>. Finally select
Build=&gt;Rebuild All.
</simpara>
</listitem>
<listitem>
<simpara>
For command line users, make sure that you either have
the C++ environment variables registered, or have run
<command>vcvars.bat</command>, and then execute one of the
following:
following commands from the <filename>c:\work\php-4.x.x\win32
</filename> directory:
</simpara>
<itemizedlist>
<listitem><simpara>
<userinput>msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"</userinput>
</simpara></listitem>
<listitem><simpara>
<userinput>msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"</userinput>
</simpara></listitem>
<listitem><simpara>
At this point, you should have a usable
<filename>php.exe</filename> in either
your <filename>Debug_TS</filename> or
<filename>Release_TS</filename> subdirectories.
</simpara></listitem>
<listitem>
<simpara>
<userinput>msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"</userinput>
</simpara>
</listitem>
<listitem>
<simpara>
<userinput>msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"</userinput>
</simpara>
</listitem>
<listitem>
<simpara>
At this point, you should have a usable <filename>php.exe</filename>
in either your <filename>c:\work\php-4.x.x.\Debug_TS</filename> or
<filename>Release_TS</filename> subdirectories.
</simpara>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<simpara>
Repeat the above steps with <filename>php4isapi.dsp</filename>
(which can be found in <filename>sapi\isapi</filename>) in
order to build the code necessary for integrating PHP with
Microsoft IIS.
It is possible to do minor customization to the build process by editing
the <filename>main/config.win32.h.in</filename> file. For example you can
change the builtin extensions, the location of &php.ini; and
</simpara>
<simpara>
It is possible to do minor customization to the build process by editing
the main/config.win32.h.in file.
Next you may want to build the CLI version which is designed to use
<link linkend="features.commandline">PHP from the command line</link>.
The steps are the same as for building the CGI version, except you have
to select the <literal>php4ts_cli - Win32 Debug_TS</literal> or
<literal>php4ts_cli - Win32 Release_TS</literal> project file. After a
succcessfull compiling run you will find the <filename>php.exe</filename>
in either the directory <filename>Release_TS\cli\</filename> or
<filename>Debug_TS\cli\</filename>.
</simpara>
<note>
<simpara>
If you want to use PEAR and the comfortable command line installer,
the CLI-SAPI is mandatory. For more information about PEAR and the
installer read the documantation at the <ulink url="&.url.php.pear;manual/">
PEAR</ulink> website.
</simpara>
</note>
<simpara>
In order to build the SAPI module (<filename>php4isapi.dll</filename>
for integrating PHP with Microsoft IIS, set your active configuration to
<filename>php4isapi-whatever-config</filename> and build the desired dll.
</simpara>
</sect3>
</sect2>