forked from pmmp/PHP-Binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows-compile-vs.ps1
573 lines (494 loc) · 20.2 KB
/
windows-compile-vs.ps1
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
$ErrorActionPreference="Stop"
$PHP_MAJOR_VER="8.2"
$PHP_VER="$PHP_MAJOR_VER.25"
$PHP_GIT_REV="php-$PHP_VER"
$PHP_DISPLAY_VER="$PHP_VER"
$PHP_SDK_VER="2.3.0"
$ARCH="x64"
#TODO: these should be selected by PHP base version
$VC_VER="vs16"
$CMAKE_TARGET="Visual Studio 16 2019"
#### NOTE: Tags with "v" prefixes behave weirdly in the GitHub API. They'll be stripped in some places but not others.
#### Use commit hashes to avoid this.
$LIBYAML_VER="0.2.5"
$PTHREAD_W32_VER="3.0.0"
$LEVELDB_MCPE_VER="1c7564468b41610da4f498430e795ca4de0931ff" #release not tagged
$LIBDEFLATE_VER="2335c047e91cac6fd04cb0fd2769380395149f15" #1.22 - see above note about "v" prefixes
$PHP_PMMPTHREAD_VER="6.1.0"
$PHP_YAML_VER="2.2.4"
$PHP_CHUNKUTILS2_VER="0.3.5"
$PHP_IGBINARY_VER="3.2.16"
$PHP_LEVELDB_VER="317fdcd8415e1566fc2835ce2bdb8e19b890f9f3" #release not tagged
$PHP_CRYPTO_VER="abbe7cbf869f96e69f2ce897271a61d32f43c7c0" #release not tagged
$PHP_RECURSIONGUARD_VER="0.1.0"
$PHP_MORTON_VER="0.1.2"
$PHP_LIBDEFLATE_VER="0.2.1"
$PHP_XXHASH_VER="0.2.0"
$PHP_XDEBUG_VER="3.3.2"
$PHP_ARRAYDEBUG_VER="0.2.0"
$PHP_ENCODING_VER="0.3.0"
function pm-echo {
param ([string] $message)
echo "[PocketMine] $message"
echo "[PocketMine] $message" >> "$log_file"
}
function pm-echo-error {
param ([string] $message)
pm-echo "[ERROR] $message"
}
function pm-fatal-error {
param ([string] $message)
pm-echo-error $message
exit 1
}
$library = ""
$library_version = ""
function write-library {
param ([string] $library, [string] $version)
Write-Host -NoNewline "[$library $version]"
$script:library = $library
$script:library_version = $version
}
function write-status {
param ([string] $status)
Write-Host -NoNewline " $status..."
echo "[$library $library_version] $status..." >> $log_file
}
function write-download {
write-status "downloading"
}
function write-extracting {
write-status "extracting"
}
function write-configure {
write-status "configuring"
}
function write-compile {
write-status "compiling"
}
function write-install {
write-status "installing"
}
function write-done {
echo " done!"
$script:library = ""
$script:library_version = ""
}
$log_file="$pwd\compile.log"
echo "" > "$log_file"
$outpath="$pwd"
pm-echo "PHP compiler for Windows"
date >> "$log_file"
pm-echo "Checking dependencies"
$script_dependencies = @("git", "cmake")
foreach ($dep in $script_dependencies) {
$depInfo = Get-Command "$dep" -ErrorAction SilentlyContinue
if ($depInfo -eq $null) {
pm-fatal-error "$dep is required but can't be found in your PATH"
} else {
pm-echo "Found $dep in $($depInfo.Source)"
}
}
pm-echo "Checking configuration options"
$PHP_DEBUG_BUILD=0
if ($env:PHP_DEBUG_BUILD -eq 1) {
$PHP_DEBUG_BUILD=1
}
$MSBUILD_CONFIGURATION="RelWithDebInfo"
$PHP_JIT_ENABLE_ARG="no"
if ($PHP_DEBUG_BUILD -eq 0) {
$OUT_PATH_REL="Release"
$PHP_HAVE_DEBUG="enable-debug-pack"
pm-echo "Building release binaries with debugging symbols"
} else {
$OUT_PATH_REL="Debug"
$PHP_HAVE_DEBUG="enable-debug"
#I don't like this, but YAML will crash if it's not built with the same target as PHP
$MSBUILD_CONFIGURATION="Debug"
pm-echo "Building debug binaries"
}
if ($env:PHP_JIT_SUPPORT -eq 1) {
$PHP_JIT_ENABLE_ARG="yes"
pm-echo "Compiling JIT support in OPcache (unstable)"
}
if ($env:PM_VERSION_MAJOR -eq $null) {
pm-fatal-error "Please specify PocketMine-MP major version by setting the PM_VERSION_MAJOR environment variable"
}
if ($env:PM_VERSION_MAJOR -lt 5) {
pm-fatal-error "PocketMine-MP 4.x and older are no longer supported"
}
$PM_VERSION_MAJOR=$env:PM_VERSION_MAJOR
pm-echo "Compiling with configuration for PocketMine-MP $PM_VERSION_MAJOR"
if ($env:SOURCES_PATH -ne $null) {
$SOURCES_PATH=$env:SOURCES_PATH
} else {
$SOURCES_PATH="C:\pocketmine-php-$PHP_DISPLAY_VER-$($OUT_PATH_REL.ToLower())"
}
pm-echo "Using path $SOURCES_PATH for build sources"
if (Test-Path "$pwd\bin") {
pm-echo "Deleting old binary folder..."
Remove-Item -Recurse -Force "$pwd\bin" 2>&1
}
if (Test-Path $SOURCES_PATH) {
pm-echo "Deleting old workspace $SOURCES_PATH..."
Remove-Item -Recurse -Force $SOURCES_PATH 2>&1
}
$download_cache="$pwd\download_cache"
function download-file {
param ([string] $url, [string] $prefix)
$cached_filename="$prefix-$($url.Substring($url.LastIndexOf("/") + 1))"
$cached_path="$download_cache\$cached_filename"
if (!(Test-Path $download_cache)) {
mkdir $download_cache >> $log_file 2>&1
}
if (Test-Path $cached_path) {
echo "Cache hit for URL: $url" >> $log_file
} else {
echo "Downloading file from $url to $cached_path" >> $log_file
Invoke-WebRequest -Uri $url -OutFile $cached_path >> $log_file 2>&1
}
if (!(Test-Path $cached_path)) {
pm-fatal-error "Failed to download file from $url"
}
return $cached_path
}
function append-file-utf8 {
param ([string] $line, [string] $file)
Out-File -Append -FilePath $file -Encoding utf8 -InputObject $line
}
function download-sdk {
write-library "PHP SDK" $PHP_SDK_VER
write-download
$file = download-file "https://github.com/php/php-sdk-binary-tools/archive/refs/tags/php-sdk-$PHP_SDK_VER.zip" "php-sdk"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item "php-sdk-binary-tools-php-sdk-$PHP_SDK_VER" $SOURCES_PATH
write-done
}
function sdk-command {
param ([string] $command, [string] $errorMessage = "")
New-Item task.bat -Value $command >> $log_file 2>&1
echo "Running SDK command: $command" >> $log_file
$wrap = "`"$SOURCES_PATH\phpsdk-$VC_VER-$ARCH.bat`" -t task.bat 2>&1"
echo "SDK wrapper command: $wrap" >> $log_file
(& cmd.exe /c $wrap) >> $log_file
$result=$LASTEXITCODE
if ($result -ne 0) {
if ($errorMessage -eq "") {
pm-fatal-error "Error code $result running SDK build command"
} else {
pm-fatal-error $errorMessage
}
}
Remove-Item task.bat
}
function download-php-deps {
write-library "PHP prebuilt deps" "$PHP_MAJOR_VER/$VC_VER"
write-download
sdk-command "phpsdk_deps -u -t $VC_VER -b $PHP_MAJOR_VER -a $ARCH -f -d $DEPS_DIR || exit 1"
write-done
}
function build-yaml {
write-library "yaml" $LIBYAML_VER
write-download
$file = download-file "https://github.com/yaml/libyaml/archive/$LIBYAML_VER.zip" "yaml"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item "libyaml-$LIBYAML_VER" libyaml >> $log_file 2>&1
Push-Location libyaml
write-configure
sdk-command "cmake -G `"$CMAKE_TARGET`"^`
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
-DBUILD_SHARED_LIBS=ON^`
`"$pwd`" || exit 1"
write-compile
sdk-command "msbuild ALL_BUILD.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
write-install
sdk-command "msbuild INSTALL.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
Copy-Item "$MSBUILD_CONFIGURATION\yaml.pdb" "$DEPS_DIR\bin" >> $log_file 2>&1
write-done
Pop-Location
}
function build-pthreads4w {
write-library "pthreads4w" $PTHREAD_W32_VER
write-download
$file = download-file "https://github.com/pmmp/DependencyMirror/releases/download/mirror/pthreads4w-code-v$PTHREAD_W32_VER.zip" "pthreads4w"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item "pthreads4w-code-*" pthreads4w >> $log_file 2>&1
Push-Location pthreads4w
write-compile
sdk-command "nmake VC || exit 1"
write-install
Copy-Item "pthread.h" "$DEPS_DIR\include" >> $log_file 2>&1
Copy-Item "sched.h" "$DEPS_DIR\include" >> $log_file 2>&1
Copy-Item "semaphore.h" "$DEPS_DIR\include" >> $log_file 2>&1
Copy-Item "_ptw32.h" "$DEPS_DIR\include" >> $log_file 2>&1
Copy-Item "pthreadVC3.lib" "$DEPS_DIR\lib" >> $log_file 2>&1
Copy-Item "pthreadVC3.dll" "$DEPS_DIR\bin" >> $log_file 2>&1
Copy-Item "pthreadVC3.pdb" "$DEPS_DIR\bin" >> $log_file 2>&1
write-done
Pop-Location
}
function build-leveldb {
write-library "leveldb" $LEVELDB_MCPE_VER
write-download
$file = download-file "https://github.com/pmmp/leveldb/archive/$LEVELDB_MCPE_VER.zip"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item leveldb-* leveldb >> $log_file 2>&1
Push-Location leveldb
write-configure
sdk-command "cmake -G `"$CMAKE_TARGET`"^`
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
-DBUILD_SHARED_LIBS=ON^`
-DLEVELDB_BUILD_BENCHMARKS=OFF^`
-DLEVELDB_BUILD_TESTS=OFF^`
-DZLIB_LIBRARY=`"$DEPS_DIR\lib\zlib_a.lib`"^`
`"$pwd`" || exit 1"
write-compile
sdk-command "msbuild ALL_BUILD.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
write-install
sdk-command "msbuild INSTALL.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
Copy-Item "$MSBUILD_CONFIGURATION\leveldb.pdb" "$DEPS_DIR\bin" >> $log_file 2>&1
write-done
Pop-Location
}
function build-libdeflate {
write-library "libdeflate" $LIBDEFLATE_VER
write-download
$file = download-file "https://github.com/ebiggers/libdeflate/archive/$LIBDEFLATE_VER.zip"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item libdeflate-* libdeflate >> $log_file 2>&1
Push-Location libdeflate
write-configure
#TODO: not sure why we have arch here but not on other cmake targets
sdk-command "cmake -G `"$CMAKE_TARGET`" -A `"$ARCH`"^`
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
-DLIBDEFLATE_BUILD_GZIP=OFF^`
-DLIBDEFLATE_BUILD_SHARED_LIB=ON^`
-DLIBDEFLATE_BUILD_STATIC_LIB=OFF^`
`"$pwd`" || exit 1"
write-compile
sdk-command "msbuild ALL_BUILD.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
write-install
sdk-command "msbuild INSTALL.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
Copy-Item "$MSBUILD_CONFIGURATION\deflate.pdb" "$DEPS_DIR\bin" >> $log_file 2>&1
write-done
Pop-Location
}
function download-php {
write-library "PHP" $PHP_VER
write-download
$file = download-file "https://github.com/php/php-src/archive/$PHP_GIT_REV.zip" "php"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
Move-Item "php-src-$PHP_GIT_REV" php-src >> $log_file 2>&1
write-done
}
function get-extension-zip {
param ([string] $name, [string] $version, [string] $url, [string] $extractedName)
write-library "php-ext $name" $version
write-download
$file = download-file $url "php-ext-$name"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
write-done
}
function get-github-extension {
param ([string] $name, [string] $version, [string] $user, [string] $repo, [string] $versionPrefix)
get-extension-zip $name $version "https://github.com/$user/$repo/archive/$versionPrefix$version.zip" "$repo-$version"
}
function download-php-extensions {
Push-Location "$SOURCES_PATH\php-src\ext" >> $log_file 2>&1
get-github-extension "pmmpthread" $PHP_PMMPTHREAD_VER "pmmp" "ext-pmmpthread"
get-github-extension "yaml" $PHP_YAML_VER "php" "pecl-file_formats-yaml"
get-github-extension "chunkutils2" $PHP_CHUNKUTILS2_VER "pmmp" "ext-chunkutils2"
get-github-extension "igbinary" $PHP_IGBINARY_VER "igbinary" "igbinary"
get-github-extension "leveldb" $PHP_LEVELDB_VER "pmmp" "php-leveldb"
get-github-extension "recursionguard" $PHP_RECURSIONGUARD_VER "pmmp" "ext-recursionguard"
get-github-extension "morton" $PHP_MORTON_VER "pmmp" "ext-morton"
get-github-extension "libdeflate" $PHP_LIBDEFLATE_VER "pmmp" "ext-libdeflate"
get-github-extension "xxhash" $PHP_XXHASH_VER "pmmp" "ext-xxhash"
get-github-extension "xdebug" $PHP_XDEBUG_VER "xdebug" "xdebug"
get-github-extension "arraydebug" $PHP_ARRAYDEBUG_VER "pmmp" "ext-arraydebug"
get-github-extension "encoding" $PHP_ENCODING_VER "pmmp" "ext-encoding"
write-library "php-ext crypto" $PHP_CRYPTO_VER
write-download
(& cmd.exe /c "git clone https://github.com/bukka/php-crypto.git crypto 2>&1") >> $log_file
Push-Location crypto
write-status "preparing"
(& cmd.exe /c "git checkout $PHP_CRYPTO_VER 2>&1") >> $log_file
(& cmd.exe /c "git submodule update --init --recursive 2>&1") >> $log_file
write-done
Pop-Location
Pop-Location
}
download-sdk
cd $SOURCES_PATH >> $log_file 2>&1
pm-echo "Checking that SDK can find Visual Studio"
#using CMAKE_TARGET for this is a bit meh but it's human readable at least
sdk-command "exit /b 0" "Please install $CMAKE_TARGET"
$DEPS_DIR="$SOURCES_PATH\deps"
#custom libs depend on some standard libs, so prepare these first
#a bit annoying because this part of the build is slow and makes it take longer to find problems
download-php-deps
$LIB_BUILD_DIR="$SOURCES_PATH\deps_build"
mkdir $LIB_BUILD_DIR >> $log_file 2>&1
cd $LIB_BUILD_DIR >> $log_file 2>&1
build-pthreads4w
build-yaml
#these two both need zlib from the standard deps
build-leveldb
build-libdeflate
cd $SOURCES_PATH >> $log_file 2>&1
download-php
download-php-extensions
cd "$SOURCES_PATH\php-src"
write-library "PHP" $PHP_VER
write-configure
sdk-command "buildconf.bat"
sdk-command "configure^`
--with-mp=auto^`
--with-prefix=pocketmine-php-bin^`
--$PHP_HAVE_DEBUG^`
--disable-all^`
--disable-cgi^`
--enable-cli^`
--enable-zts^`
--enable-pdo^`
--enable-arraydebug=shared^`
--enable-bcmath^`
--enable-calendar^`
--enable-chunkutils2=shared^`
--enable-com-dotnet^`
--enable-ctype^`
--enable-encoding=shared^`
--enable-fileinfo=shared^`
--enable-filter^`
--enable-hash^`
--enable-igbinary=shared^`
--enable-json^`
--enable-mbstring^`
--enable-morton^`
--enable-opcache^`
--enable-opcache-jit=$PHP_JIT_ENABLE_ARG^`
--enable-phar^`
--enable-recursionguard=shared^`
--enable-sockets^`
--enable-tokenizer^`
--enable-xmlreader^`
--enable-xmlwriter^`
--enable-xxhash^`
--enable-zip^`
--enable-zlib^`
--with-bz2=shared^`
--with-crypto=shared^`
--with-curl^`
--with-dom^`
--with-gd=shared^`
--with-gmp^`
--with-iconv^`
--with-leveldb=shared^`
--with-libdeflate=shared^`
--with-libxml^`
--with-mysqli=shared^`
--with-mysqlnd^`
--with-openssl^`
--with-pcre-jit^`
--with-pmmpthread=shared^`
--with-pmmpthread-sockets^`
--with-simplexml^`
--with-sodium^`
--with-sqlite3=shared^`
--with-xdebug=shared^`
--with-xdebug-compression^`
--with-xml^`
--with-yaml^`
--with-pdo-mysql^`
--with-pdo-sqlite^`
--without-readline"
write-compile
sdk-command "nmake"
write-install
sdk-command "nmake snap"
#remove ICU DLLs copied unnecessarily by nmake snap - this needs to be removed if we ever have ext/intl as a dependency
Remove-Item "$SOURCES_PATH\php-src\$ARCH\Release_TS\php-$PHP_DISPLAY_VER\icu*.dll" >> $log_file 2>&1
#remove enchant dependencies which are unnecessarily copied - this needs to be removed if we ever have ext/enchant as a dependency
Remove-Item "$SOURCES_PATH\php-src\$ARCH\Release_TS\php-$PHP_DISPLAY_VER\glib-*.dll" >> $log_file 2>&1
Remove-Item "$SOURCES_PATH\php-src\$ARCH\Release_TS\php-$PHP_DISPLAY_VER\gmodule-*.dll" >> $log_file 2>&1
Remove-Item -Recurse "$SOURCES_PATH\php-src\$ARCH\Release_TS\php-$PHP_DISPLAY_VER\lib\enchant\" >> $log_file 2>&1
cd $outpath >> $log_file 2>&1
Move-Item -Force "$SOURCES_PATH\php-src\$ARCH\$($OUT_PATH_REL)_TS\php-debug-pack-*.zip" $outpath
Remove-Item -Recurse bin -ErrorAction Continue >> $log_file 2>&1
mkdir bin >> $log_file 2>&1
Move-Item "$SOURCES_PATH\php-src\$ARCH\$($OUT_PATH_REL)_TS\php-$PHP_DISPLAY_VER" bin\php
$php_exe = "$outpath\bin\php\php.exe"
if (!(Test-Path $php_exe)) {
pm-fatal-error "Something has gone wrong. php.exe not found"
}
write-status "generating php.ini"
$php_ini="$outpath\bin\php\php.ini"
#all this work to make PS output utf-8/ascii instead of utf-16 :(
Out-File -FilePath $php_ini -Encoding ascii -InputObject ";Custom PocketMine-MP php.ini file"
append-file-utf8 "memory_limit=1024M" $php_ini
append-file-utf8 "display_errors=1" $php_ini
append-file-utf8 "display_startup_errors=1" $php_ini
append-file-utf8 "error_reporting=-1" $php_ini
append-file-utf8 "zend.assertions=-1" $php_ini
append-file-utf8 "extension_dir=ext" $php_ini
append-file-utf8 "extension=php_pmmpthread.dll" $php_ini
append-file-utf8 "extension=php_openssl.dll" $php_ini
append-file-utf8 "extension=php_chunkutils2.dll" $php_ini
append-file-utf8 "extension=php_igbinary.dll" $php_ini
append-file-utf8 "extension=php_leveldb.dll" $php_ini
append-file-utf8 "extension=php_crypto.dll" $php_ini
append-file-utf8 "extension=php_libdeflate.dll" $php_ini
append-file-utf8 "igbinary.compact_strings=0" $php_ini
append-file-utf8 "zend_extension=php_opcache.dll" $php_ini
append-file-utf8 "opcache.enable=1" $php_ini
append-file-utf8 "opcache.enable_cli=1" $php_ini
append-file-utf8 "opcache.save_comments=1" $php_ini
append-file-utf8 "opcache.validate_timestamps=1" $php_ini
append-file-utf8 "opcache.revalidate_freq=0" $php_ini
append-file-utf8 "opcache.file_update_protection=0" $php_ini
append-file-utf8 "opcache.optimization_level=0x7FFEBFFF" $php_ini
append-file-utf8 "opcache.cache_id=PHP_BINARY ;prevent sharing SHM between different binaries - they won't work because of ASLR" $php_ini
append-file-utf8 ";Optional extensions, supplied for plugin use" $php_ini
append-file-utf8 "extension=php_fileinfo.dll" $php_ini
append-file-utf8 "extension=php_gd.dll" $php_ini
append-file-utf8 "extension=php_mysqli.dll" $php_ini
append-file-utf8 "extension=php_sqlite3.dll" $php_ini
append-file-utf8 ";Optional extensions, supplied for debugging" $php_ini
append-file-utf8 "extension=php_recursionguard.dll" $php_ini
append-file-utf8 "recursionguard.enabled=0 ;disabled due to minor performance impact, only enable this if you need it for debugging" $php_ini
append-file-utf8 ";extension=php_arraydebug.dll" $php_ini
append-file-utf8 "" $php_ini
if ($PHP_JIT_ENABLE_ARG -eq "on") {
append-file-utf8 "; ---- ! WARNING ! ----" $php_ini
append-file-utf8 "; JIT can provide big performance improvements, but as of PHP %PHP_VER% it is still unstable. For this reason, it is disabled by default." $php_ini
append-file-utf8 "; Enable it at your own risk. See https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit for possible options." $php_ini
append-file-utf8 "opcache.jit=off" $php_ini
append-file-utf8 "opcache.jit_buffer_size=128M" $php_ini
append-file-utf8 "" $php_ini
}
append-file-utf8 ";WARNING: When loaded, xdebug 3.2.0 will cause segfaults whenever an uncaught error is thrown, even if xdebug.mode=off. Load it at your own risk." $php_ini
append-file-utf8 ";zend_extension=php_xdebug.dll" $php_ini
append-file-utf8 ";https://xdebug.org/docs/all_settings#mode" $php_ini
append-file-utf8 "xdebug.mode=off" $php_ini
append-file-utf8 "xdebug.start_with_request=yes" $php_ini
append-file-utf8 ";The following overrides allow profiler, gc stats and traces to work correctly in ZTS" $php_ini
append-file-utf8 "xdebug.profiler_output_name=cachegrind.%s.%p.%r" $php_ini
append-file-utf8 "xdebug.gc_stats_output_name=gcstats.%s.%p.%r" $php_ini
append-file-utf8 "xdebug.trace_output_name=trace.%s.%p.%r" $php_ini
append-file-utf8 ";Optional experimental extensions" $php_ini
append-file-utf8 "extension=php_encoding.dll" $php_ini
write-done
pm-echo "Xdebug is included, but disabled by default. To enable it, change 'xdebug.mode' in your php.ini file."
pm-echo "NOTE: You may need to install VC++ Redistributable for the binaries to work. Download it here: https://aka.ms/vs/16/release/vc_redist.x64.exe"
pm-echo "PHP binary files installed in $outpath\bin"
pm-echo "If the binary doesn't work, please report an issue at https://github.com/pmmp/PHP-Binaries and attach the `"compile.log`" file"