|
|
 |
This chapter teaches how to compile PHP from sources on windows, using
Microsoft's tools. To compile PHP with cygwin, please refer to CapÃtulo 4.
To compile and build PHP you need a Microsoft Development Environment.
Microsoft Visual C++ 6.0 is recommended, though Visual C++ .NET versions
will also work. Since PHP 5 the free Microsoft .NET toolchain is also
supported (you need to install Windows Platform SDK, Visual C++ Toolkit and
.NET Framework SDK).
To extract the downloaded files you will also need a ZIP extraction
utility. Windows XP and newer already include this functionality built-in.
Before you get started, you have to download:
the win32 buildtools from the PHP site at /extra/win32build.zip.
the source code for the DNS name resolver used by PHP from /extra/bindlib_w32.zip. This is a
replacement for the resolv.lib library included in
win32build.zip.
If you plan to compile PHP as a Apache module you will also need the
Apache sources.
Finally, you are going to need the source to PHP itself. You can get the
latest development version using anonymous
CVS, a snapshot or the
most recent released source
tarball.
After downloading the required packages you have to extract them in a
proper place:
Create a working directory where all files end up after extracting, e.g:
C:\work.
Create the directory win32build under your working
directory (C:\work) and unzip
win32build.zip into it.
Create the directory bindlib_w32 under your working
directory (C:\work) and unzip
bindlib_w32.zip into it.
Extract the downloaded PHP source code into your working directory
(C:\work).
Build the libraries you are going to need (or download the binaries if
available) and place the headers and libs in the C:\work\win32build\include and C:\work\win32build\lib directories,
respectively.
If you don't have cygwin installed with bison and flex, you also need to
make the C:\work\win32build\bin
directory available in the PATH, so that thoses tools can be found by
the configure script.
Following this steps your directory structure looks like this:
+--C:\work
| |
| +--bindlib_w32
| | |
| | +--arpa
| | |
| | +--conf
| | |
| | +--...
| |
| +--php-5.x.x
| | |
| | +--build
| | |
| | +--...
| | |
| | +--win32
| | |
| | +--...
| |
| +--win32build
| | |
| | +--bin
| | |
| | +--include
| | |
| | +--lib |
If you aren't using Cygwin, you must also
create the directories C:\usr\local\lib and then copy
bison.simple from C:\work\win32build\bin to C:\usr\local\lib.
Nota:
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 PEAR website.
You must build the resolv.lib library. Decide whether
you want to have debug symbols available (bindlib - Win32 Debug) or not
(bindlib - Win32 Release), but please remember the choice you made, because
the debug build will only link with PHP when it is also built in debug mode.
Build the appropriate configuration:
For GUI users, launch VC++, by double-clicking in
C:\work\bindlib_w32\bindlib.dsw. Then select
Build=>Rebuild All.
For command line users, make sure that you either have the C++
environment variables registered, or have run
vcvars.bat, and then execute one of the following
commands:
At this point, you should have a usable resolv.lib in
either your C:\work\bindlib_w32\Debug or
Release subdirectories. Copy this file into your
C:\work\win32build\lib directory
over the file by the same name found in there.
This chapter explains how to compile PHP >=5 using the new build system,
which is CLI-based and very similar with the main PHP's Unix build system.
Before starting, be sure you have read la sección de nombre Putting it all together and you have built all needed
libraries, like Libxml or ICU (needed for PHP >= 6).
First you should open a Visual Studio Command Prompt, which should be
available under the Start menu. A regular Command Prompt window shouldn't
work, as probably it doesn't have the necessary environment variables set.
Then type something like cd C:\work\php-5.x.x to enter
in the PHP source dir. Now you are ready to start configuring PHP.
The second step is running the buildconf batch file to
make the configure script, by scanning the folder for
config.w32 files. By default this command will also
search in the following directories: pecl;
..\pecl; pecl\rpc; ..\pecl\rpc. Since PHP 5.1.0, you can change
this behaviour by using the --add-modules-dir argument
(e.g. cscript /nologo win32/build/buildconf.js
--add-modules-dir=../php-gtk2 --add-modules-dir=../pecl).
The third step is configuring. To view the list of the available
configuration options type cscript /nologo configure.js
--help. After choosing the options that you will enable/disable,
type something like: cscript /nologo configure.js --disable-foo
--enable-fun-ext. Using --enable-foo=shared
will attempt to build the 'foo' extension as a shared, dynamically loadable
module.
The last step is compiling. To achieve this just issue the command
nmake. The generated files (e.g. .exe and .dll) will be
placed in either Release_TS or
Debug_TS directories (if built with
Thread safety), or in the Release or
Debug directories otherwise.
Optionally you may also run PHP's test suite, by typing nmake
test. If you want to run just a specific test, you may use the
'TESTS' variable (e.g. nmake /D TESTS=ext/sqlite/tests
test - will only run sqlite's tests). To delete the files that
were created during the compilation, you can use the nmake
clean command.
A very useful configure option to build snapshots is
--enable-snapshot-build, which add a new compiling mode
(nmake build-snap). This tries to build every extension
available (as shared, by default), but it will ignore build errors in
individual extensions or SAPI.
Compiling PHP using the DSW files isn't supported as of PHP 5, as a much
more flexible system was made
available. Anyway, you can still use them, but keep in mind that
they are not maintained very often, so you can have compiling problems. To
compile PHP 4 for windows, this is the only available way though.
The first 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:
Executable files: C:\work\win32build\bin, Cygwin users:
C:\cygwin\bin
Include files: C:\work\win32build\include
Library files: C:\work\win32build\lib
The best way to get started is to build the CGI version:
For GUI users, launch VC++, and then select File => Open Workspace
and select C:\work\php-4.x.x\win32\php4ts.dsw. Then
select Build=>Set Active Configuration and select the desired
configuration, either php4ts - Win32 Debug_TS or
php4ts - Win32 Release_TS. Finally select
Build=>Rebuild All.
For command line users, make sure that you either have the C++
environment variables registered, or have run
vcvars.bat, and then execute one of the following
commands from the C:\work\php-4.x.x\win32 directory:
msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"
msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"
At this point, you should have a usable php.exe
in either your C:\work\php-4.x.x\Debug_TS or
Release_TS subdirectories.
It is possible to do minor customization to the build process by editing
the main/config.win32.h file. For example you can
change the default location of php.ini, the built-in extensions, and the
default location for your extensions.
Next you may want to build the CLI version which is designed to use PHP from the command line. The steps
are the same as for building the CGI version, except you have to select
the php4ts_cli - Win32 Debug_TS or php4ts_cli
- Win32 Release_TS project file. After a successful compiling
run you will find the php.exe in either the directory
Release_TS\cli\ or Debug_TS\cli\.
In order to build the SAPI module (php4isapi.dll) for
integrating PHP with Microsoft IIS, set your active configuration to
php4isapi-whatever-config and build the desired dll.
add a note
User Contributed Notes
Building from source
zbowden at vt dot edu
12-May-2006 07:12
When running "cscript /nologo configure.js" 5.x on Windows
2000 or XP, if you get the following error:
Microsoft JScript runtime error: Object doesn't support this
property or method
You need to have at least version 5.6 of WSH.
This is necessary because configure.js will use the .Exec()
method of the WScript.Shell.
This evidently didn't exist until 5.6?
You can download WSH 5.6 here:
http://www.microsoft.com/downloads/details.aspx?
FamilyID=c717d943-7e4b-4622-86eb-95a22b832caa&DisplayLang=en
C-Reaction.net - Software Development
03-Apr-2006 12:16
Don't forget to setup Environment variable:
BISON_SIMPLE="C:\\work\\win32build\\bin\\bison.simple"
or this can cause error:
c:/usr/local/lib/bison.simple: No such file or directory
Alexey Furmanov.
26-Jan-2005 04:30
Compiling using Visual Studio .NET will create binaries dependent of msvcp71.dll which has three repercussions:
1. This dll will need to be distributed.
2. The binaries are not currently compatible with the Zend optimiser (not sure why it should make a difference but it does).
3. Binaries are larger!
| |
|
| Chiste de... En el colegio | | Cigüeñas | En clase de zoología, el maestro de primaria dice a sus alumnos que le escuchan atentamente:
- La mayor de las aves zancudas es la cigüeña.
Y uno de sus pequeños alumnos replica.
- No nos venga con cuentos profesor, que ya tenemos edad para saber que las cigüeñas no existen. | | Chistes en tu mail | | ©ContenidosGratis |
| Inicio | Acción | Estrategia | Palabras | Puzzles | Solitarios | Foro Trucos |  | Cake Mania Jugadores: 6835 Categoría del juego: Acción Objetivo del juego: Ayuda a Jill a recuperar la pastelería de su abuela llevando su propia pastelería; consigue clientes y gana dinero. |
|  | Rainbow Web Jugadores: 2199 Categoría del juego: Puzzles Objetivo del juego: Rompe un pegajoso hechizo y salva un reino de fantasía en Rainbow Web. Tendrás toneladas de diversión mientras juegas a este mágico desafío para la mente. |
|  | Mahjongg Fortuna Jugadores: 12462 Categoría del juego: Solitarios Objetivo del juego: Velocidad y habilidad mental son las armas más importantes en esta versión de un antiguo juego asiático. Despeja el tablero lo antes posible haciendo clic en las fichas iguales y gánate la fama eterna de la puntuación más alta. |
|  | Chainz 2 Jugadores: 6955 Categoría del juego: Puzzles Objetivo del juego: Entra en el mundo de las combinaciones con Chainz 2: Relinked, emocionante secuela del exitazo del año pasado, Chainz. Gira eslabones y crea combinaciones de 3 ó más. |
|  | Delicious Jugadores: 4405 Categoría del juego: Acción Objetivo del juego: ¿Eres un as de la multitarea? ¿Quieres que tus clientes estén contentos? ¡Pues Delicious es tu juego! Sacia el apetito de los clientes y tenlos contentos; ¡no te arriesgues! |
|  | Bookworm Jugadores: 4568 Categoría del juego: Palabras Objetivo del juego: Junta las letras para formar palabras. ¡Las palabras más largas valen más puntos! |
|  | Zuma Jugadores: 4976 Categoría del juego: Acción Objetivo del juego: Controla el ídolo de la rana de piedra de los antiguos Zuma en este intrigante enigma de acción. ¡Dispara bolas para formar conjuntos de tres, pero si dejas que lleguen a la calavera dorada morirás! |
|  | Jewel of Atlantis Jugadores: 3798 Categoría del juego: Puzzles Objetivo del juego: Descubre la ciudad hundida de la Atlántida y busca valiosos tesoros. Viaja más allá de las profundidades del mar y vive trepidantes aventuras en Jewel of Atlantis. |
|  | Jewel Quest Jugadores: 3727 Categoría del juego: Puzzles Objetivo del juego: Convierte la arena de la antigua selva en oro tan rápido como puedas juntando grupos de 3 elementos. ¡Los grupos más grandes valen más puntos! |
|  | Bejeweled 2 Jugadores: 3659 Categoría del juego: Puzzles Objetivo del juego: Con cuatro modos de juego únicos y fascinantes, nuevas piezas de juego explosivas e imponentes fondos planetarios, Bejeweled 2 es mucho más adictivo que nunca. |
|
|