Files
doc-en/install/windows/building.xml
T
Nuno Lopes 8606117ead fix build
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166431 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-15 12:42:40 +00:00

332 lines
12 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<sect1 id="install.windows.building">
<title>Building from source</title>
<para>
Before getting started, it is worthwhile answering the question:
"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>
</orderedlist>
<sect2 id="install.windows.building.requirement">
&reftitle.required;
<para>
To compile and build PHP you need a Microsoft
Development Environment. Microsoft Visual C++ 6.0 is recommended.
To extract the downloaded files you need a extraction utility
(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>
<para>
Before you get started, you have to download...
</para>
<itemizedlist>
<listitem>
<simpara>
..the win32 buildtools from the PHP 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 PHP 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 PHP 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 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>
</sect2>
<sect2 id="install.windows.building.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 class="directory">C:\work</filename>.
</simpara>
</listitem>
<listitem>
<simpara>
Create the directory <filename>win32build</filename> under your
working directory (<filename class="directory">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 class="directory">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 class="directory">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 class="directory">c:\usr\local\lib</filename>. Copy
<filename>bison.simple</filename> from <filename class="directory">c:\work\win32build\bin
</filename> to <filename class="directory">c:\usr\local\lib</filename>.
</para>
<note>
<simpara>
<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>
</sect2>
<sect2 id="install.windows.building.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>
Executable files: <filename class="directory">c:\work\win32build\bin</filename>,
Cygwin users: <filename>cygwin\bin</filename>
</simpara>
</listitem>
<listitem>
<simpara>
Include files: <filename class="directory">c:\work\win32build\include</filename>
</simpara>
</listitem>
<listitem>
<simpara>
Library files: <filename class="directory">c:\work\win32build\lib</filename>
</simpara>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="install.windows.building.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 class="directory">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>
<simpara>
<userinput>msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"</userinput>
</simpara>
</listitem>
<listitem>
<simpara>
<userinput>msdev bindlib.dsp /MAKE "bindlib - Win32 Release"</userinput>
</simpara>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
At this point, you should have a usable <filename>resolv.lib</filename>
in either your <filename class="directory">c:\work\bindlib_w32\Debug</filename> or
<filename>Release</filename> subdirectories. Copy this file into your
<filename class="directory">c:\work\win32build\lib</filename> directory over the file
by the same name found in there.
</para>
</sect2>
<sect2 id="install.windows.building.compile">
<title>Compiling</title>
<simpara>
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 <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 commands from the <filename class="directory">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 class="directory">c:\work\php-4.x.x.\Debug_TS</filename> or
<filename>Release_TS</filename> subdirectories.
</simpara>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<simpara>
It is possible to do minor customization to the build process by editing
the <filename>main/config.win32.h</filename> file. For example you can
change the default location of &php.ini;, the built-in extensions, and the
default location for your extensions.
</simpara>
<simpara>
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
successful compiling run you will find the <filename>php.exe</filename>
in either the directory <filename class="directory">Release_TS\cli\</filename> or
<filename class="directory">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 documentation 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>
</sect2>
</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:"../../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
-->