microsoft / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
270 stars 79 forks source link

phpsdk_deps update exception on Windows x64 (empty user agent) #37

Closed imavo closed 6 years ago

imavo commented 6 years ago

TLDR: phpsdk_deps --update ... step throws exceptions on Win 8.1 x64

I use Windows 8.1 pro x64. Installed Visual-Studio-Community-2017 (v15.7.3) and Git (2.17) from git-scm.com. I also get the same symptom on Windows 7.1 pro. Both are physical machines.

PHP is not installed. I want to build PHP-7.2.6 because I want to compile a non-core extension (build DLL) for php-7.2.6.

I have a problem with the instructions shown in the 'Basic usage example' section of the readme, specifically with the step:

"phpsdk_deps --update --branch master, use phpsdk_deps --update --branch X.Y for a non master branch"

That phpsdk_deps step fails with this message:

$ phpsdk_deps --update --branch master

 Fatal error: Uncaught SDK\Exception: Failed to fetch supported branches in C:\php-sdk\lib\php\libsdk\SDK\Config.php:154
 Stack trace:
 #0 C:\php-sdk\lib\php\libsdk\SDK\Config.php(164): SDK\Config::getKnownBranches()
 #1 C:\php-sdk\bin\phpsdk_deps.php(105): SDK\Config::setCurrentBranchName('master')
 #2 {main}
   thrown in C:\php-sdk\lib\php\libsdk\SDK\Config.php on line 154

Before I got the above problem, I ran these commands, successfully:

git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk

cd C:\php-sdk

git checkout php-sdk-2.0.12

phpsdk-vc15-x64.bat

phpsdk_buildtree phpmaster

git clone -b PHP-7.2.6 https://github.com/php/php-src.git

In Config.php line 130 $tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/"); is returning in $tmp a message complaining about empty user agent. An earlier issue mentioned this. I'm using what I think is the latest sdk. phpsdk_version reports 2.0.12

weltling commented 6 years ago

Thanks for the report. 2.0.12 is not the latest, it's 2.1.5 at this time. This issue was fixed back in winter, AFAIR.

Thank.

develforever commented 5 years ago

FileOps.php, line 133 curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); works for me.