Skip to content

Commit 2477859

Browse files
author
Martin Köditz
authored
Added Windows build instructions
1 parent de72763 commit 2477859

File tree

1 file changed

+79
-1
lines changed

1 file changed

+79
-1
lines changed

README.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,83 @@ $ Don't forget to run 'make test'.
2626
```
2727
You can find the `interbase.so` file in directory `php-firebird/modules`. Copy the file to your php extension dir and restart your webserver.
2828

29-
## Clean up your working directory
29+
#### Clean up your working directory
3030
After you've created the binary data, many temporary files will be created in your working directory. These can be removed with the command `phpize --clean`. Then you have a tidy directory again.
31+
32+
### Build the driver on Windows
33+
First of all, we have to meet some requirements. This means we need to install the Git for Windows and Visual Studio 2017 with following components:
34+
Visual C++ 2017 (vc15) or Visual C++ 2019 (vc16) must be installed prior SDK usage. Required components
35+
- C++ dev
36+
- Windows SDK
37+
- .NET dev
38+
39+
Also make sure you are using a 64-bit build host with Windows 7 or later.
40+
Of course we need some Firebird related stuff. The easiest way is to install the related Firebird version on your build host including the development files.
41+
42+
To start the build process open a command line. We assume that the build is done in the directory `c:\php-sdk`. So make sure you have the permission to create that folder on Drive C:.
43+
```
44+
git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk
45+
cd c:\php-sdk
46+
git checkout php-sdk-2.2.0
47+
```
48+
With the above we downloaded the PHP SDK and entered our working directory.
49+
50+
Next we will prepare our build environment.
51+
For Win32 do:
52+
```
53+
phpsdk-vc15-x86.bat
54+
```
55+
Use following command for Win64:
56+
```
57+
phpsdk-vc15-x64.bat
58+
```
59+
If you use VS 2019, replace vc15 by vc16.
60+
61+
Now let's create the build structure, download the PHP sources and checkout the desired development branch:
62+
```
63+
phpsdk_buildtree phpmaster
64+
git clone https://github.com/php/php-src.git && cd php-src && git checkout PHP-7.4.0
65+
```
66+
67+
Since we have our PHP sources now, we're on to get the depending libraries.
68+
```
69+
phpsdk_deps --update --branch 7.4
70+
```
71+
72+
In the next step we will download our Firebird extension sources.
73+
```
74+
mkdir ..\pecl
75+
git clone https://github.com/FirebirdSQL/php-firebird.git ..\pecl\interbase
76+
```
77+
78+
If everything is ok, we can now compile our PHP extension. Please specify the the correct path to your Firebird installation.
79+
80+
#### Build TS extension
81+
Usually you will build thread safe extensions.
82+
For Win32 thread safe (TS) do:
83+
```
84+
buildconf && configure --enable-cli --with-interbase="shared,C:\Program Files (x86)\Firebird\3_0" && nmake
85+
```
86+
For Win64thread safe (TS) do:
87+
```
88+
buildconf && configure --enable-cli --with-interbase="shared,C:\Program Files\Firebird\3_0" && nmake
89+
```
90+
After the compilation you can find your extension called `php_interbase.dll` e.g. in `C:\php-sdk\phpmaster\vc15\x64\php-src\x64\Release_TS\php_interbase.dll`
91+
Replace x64 with x86 for Win32.
92+
93+
#### Build NTS extension
94+
For Win32 non-thread safe (NTS) run:
95+
```
96+
buildconf && configure --disable-zts --enable-cli --with-interbase="shared,C:\Program Files (x86)\Firebird\3_0" && nmake
97+
```
98+
For Win64 non-thread safe (NTS) run:
99+
```
100+
buildconf && configure --disable-zts --enable-cli --with-interbase="shared,C:\Program Files\Firebird\3_0" && nmake
101+
```
102+
After the compilation you can find your extension called `php_interbase.dll` e.g. in `C:\php-sdk\phpmaster\vc15\x86\php-src\Release`
103+
Replace x86 with x64 for Win64.
104+
105+
106+
107+
108+

0 commit comments

Comments
 (0)