Home » Php » How do you compile a PHP extension on windows with cygwin/mingw?

How do you compile a PHP extension on windows with cygwin/mingw?

Posted by: admin July 12, 2020 Leave a comment

Questions:

I am trying to build the RabbitMQ PHP wrapper and the AMPQ PHP wrapper on Windows (64) using Cygwin.
I have successfully built the underlying C library (librabbitmq.dll) but I am stuck at the ‘phpize’ step:

phpize && ./configure --with-rabbit && make && sudo make install

If I understand correctly, there is no ‘phpize’ on windows, so how do I build my PHP wrapper?

Note that I’m totally new to building PHP extensions (be it on linux or windows).

How to&Answers:

This is totally not supported. PHP is designed to be compiled with GNUmake on UNIX/POSIX systems and Visual C++ on Windows systems.

Your only option, really, is to download Microsoft Visual Studio 2008 Express (2010 is not certified to work at present, to my knowledge).

You can then link to dlls compiled using mingw in your own custom extension. Try this Stack Overflow guide: From MinGW static library (.a) to Visual Studio static library (.lib).