Conversation
…tream handling Co-authored-by: souravdutt <49240259+souravdutt@users.noreply.github.com>
|
@copilot
✔ Downloading PHP binary for win complete! |
…th php8.dll Co-authored-by: souravdutt <49240259+souravdutt@users.noreply.github.com>
... The PHP runtime failure was caused by the Fixed in commit
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
Test if official PHP windows download is accessible and what URL format worksurl = 'REDACTED'
|
Windows installs failed because the tool invoked
unzip(not available on Windows), used a barephpbinary path, and the customphp-win.ziponly contained a 178 KB thinphp.exelauncher stub withoutphp8.dll— the actual PHP engine required to run.Changes
PHP binary extraction: Replaced
unzipshell command withadm-zipfor.ziparchives on Windows — no system dependency required.PHP_BINpath: AddedIS_WINDOWSflag;PHP_BINnow resolves tophp.exeon Windows soexecSynccan actually run it:Official PHP Windows distribution: Added
PHP_WIN_URLpointing to the officialwindows.php.netrelease which bundlesphp.exe,php8.dll, and all required runtime DLLs. The customphp-win.zipinsouravdutt/php-binariesonly ships the thin launcher withoutphp8.dll, causingphp.exe -vto fail immediately:setupBinaries()now uses this URL on Windows instead of the incomplete custom binary.phpFileexact match on Windows: Changed the PHP binary finder from.endsWith(".exe")tof === "php.exe"to prevent accidentally selectingphpdbg.exefrom the official distribution.downloadFileredirect handling: The original code opened aWriteStreamthen immediately calleddownloadFilerecursively on redirect without closing the first handle. On Windows, open handles are exclusively locked — this would cause the second write to fail. Fixed by closing the stream in a callback before recursing:HTTP error detection:
downloadFilenow rejects immediately on non-200 responses (with cleanup inside thefile.close()callback) to prevent a 404 HTML page from being silently saved as a zip and failing extraction later.fs.unlinkSyncsafety: Error handler now closes the stream first (withrejectinside the callback) and guards withfs.existsSyncbefore unlinking, ensuring cleanup completes before the promise rejects and preventing a throw when the connection fails before any bytes are written.Skip redundant rename:
fs.renameSyncis now skipped when source and destination paths are identical (e.g.php.exe→php.exeon Windows).Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.