1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
|
<?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 => 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 => Open
Workspace, navigate to <filename class="directory">c:\work\bindlib_w32</filename> and
select <filename>bindlib.dsw</filename>. Then select Build=>Set
Active Configuration and select the desired configuration.
Finally select Build=>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 => Open
Workspace and select <filename>c:\work\php-4.x.x\win32\php4ts.dsw
</filename>. Then select Build=>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=>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
-->
|