I have PHP 8.2.4 installed on my Windows machine and I would like to enable the YAML extension. The instructions that I have followed in the past are to download the the Windows DLL from the PECL YAML site: https://pecl.php.net/package/yaml
However, the site (at this point in time) doesn't have a built DLL for PHP 8.2.
I tried following the steps provided in the following document but it wasn't generating the correct DLL:
https://wiki.php.net/internals/windows/stepbystepbuild
When I tried copying the DLL into the php extensions folder and enabling it in the php.ini, it gives an error for that extension.
Here's what I did to compile a compatible version using the following site as a guide:
https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2#building_pecl_extensions_with_phpize
- Install Virtual Studio Build Tools 2019
Components
- Windows Universal C Runtime
- C++ Build Tools core features
- MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)
- C++ CMake tools for Windows
- Testing tools core features - Build Tools
- C++ v14.29 (16.10) MFC for v142 build tools (x86 & x64)
- Windows 10 SDK (10.0.20348.0)
- Download Windows PHP and Windows PHP Development Package (on download page) https://windows.php.net/download/
- Download libyaml from PHP pecl deps https://windows.php.net/downloads/pecl/deps/
- Create a build folder for libraries (D:\build)
- Extract the Windows PHP Development Package into that folder
- Extract the libyaml into that folder as "libyaml"
- Clone the yaml repo https://github.com/php/pecl-file_formats-yaml.git into that folder
- Clone the Microsoft PHP binary tools https://github.com/Microsoft/php-sdk-binary-tools.git into that folder and checkout the latest tag (php-sdk-2.2.0)
- Open the visual studio app, x64 Native Tools Command Prompt for VS 2019 (you can find it in the start menu; search for native)
- Change directory to the php-sdk-binary-tools folder and run
phpsdk-vs16-x64.bat
- Set the path to include the PHP that you download and the development package folders on the path:
set PATH=D:\php-8.2.4;D:\build\php-8.2.4-devel-vs16-x64;%PATH%
- Change directory to the pecl folder "pecl-file_formats-yaml"
- Run
phpize
- Then run
configure --with-yaml --with-php-build=..\libyaml
- Run
nmake
The yaml dll file will be located in the subdirectory, x64\Release as php_yaml.dll