Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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).

like image 917
dimdm Avatar asked Sep 14 '10 17:09

dimdm


People also ask

How do I enable PHP extensions in windows?

On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way. To load an extension, you need to have it available as a ". dll" file on your system.

Should I use Cygwin or MinGW?

MinGW is higher performance than Cygwin, but it's also 32-bit which may be a problem with your applications. There is a 64-bit environment similar to MinGW but it's a different project. MinGW-w64 is in all senses the successor to MinGW. org's version.

Can I install both Cygwin and MinGW?

You can install MinGW-W64 under "Cygwin" by selecting these packages (under "Devel" category): mingw64-x86_64-gcc-core : 64-bit C compiler for native 64-bit Windows. The executable is " x86_64-w64-mingw32-gcc ". mingw64-x86_64-gcc-g++ : 64-bit C++ compiler for native 64-bit Windows.


1 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).

like image 138
Theodore R. Smith Avatar answered Oct 16 '22 13:10

Theodore R. Smith