phpwindowsphp-extension

compiling shared php-module as dll (windows)


i'm trying to compile a shared extension for php 8.3.6 x64 for windows i basicly followed these instructions: https://ourcodeworld.com/articles/read/804/how-to-compile-a-php-extension-dll-file-in-windows-with-visual-studio#disqus_thread

Problem: PHP Warning: PHP Startup: Unable to load dynamic library 'php_mailparse.dll' (tried: ./ext\php_mailparse.dll (Die angegebene Prozedur wurde nicht gefunden)) in Unknown on line 0

so what did i do:

-----------------------
| Extension  | Mode   |
-----------------------
...
| mailparse  | shared |
...
-----------------------


Enabled SAPI:
-------------
| Sapi Name |
-------------
| cli       |
-------------

-----------------------------------------
| Build type          | Release         |
| Thread Safety       | No              |
| Compiler            | Visual C++ 2019 |
| Target Architecture | x64             |
| Host Architecture   | x64             |
| Optimization        | PGO disabled    |
| Native intrinsics   | SSE2            |
| Static analyzer     | disabled        |
-----------------------------------------

now in php-sdk\x64\Release i found a php_mailparse.dll, [edit] and copied it to the ext-folder of the precompiled php-binaries, [/edit] but this dll gives me the error written at the beginning ... anybody know what i've done wrong?


Solution

  • thanks to @shingo and a little experiment i got it working, as @shingo posted in his comment compiling shared php-module as dll (windows) i've done the following based on the instructions of https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2#building_pecl_extensions

    i have installed Visual Studio Community 2019 with the following components (i don't know which one a really needed, just glad it worked overall ^^)

    • MSVC v142 - VS 2019 C++ -x64/x86Buildtools
    • Windows 10 SDK
    • Just-In-Time-Debugger
    • C++-Profilingtools
    • C++-CMake-Tools for Windows
    • C++ AddressSanitizer

    now:

    now open command prompt:

    now i copied php_mbstring.dll and php_mailparse.dll from C:\php-sdk\php-8.3.6-src\x64\Release to the extension-folder of my running prebuild php-binaries ext-folder, REPLACING the existing php_mbstring.dll and now it works ;)