Configuring PHP: --with-extension or --enable-extension?

This is a small thing that got me wondering in the past but it wasn’t until recently, when I started picking up developing PHP extensions, that I wanted to know: when does one use --with-extension and when does one use --enable-extension? The answer is easy but you just have to remember ;-)

--with-extension is used if you want to refer to an external directory or libraries, for example --with-mysql[=DIR]. The extension can’t be built without external mysql headers, thus the –with switch.

--enable-extension is used if you just need to tell PHP to enable the extension in question, for example --enable-mbstring. Mbstring support is built in with PHP, you just tell it to enable it.

You should know that, if you are building your own extension, you should only pick and use the one that is most appropriate for your extension, but never both.

0 Responses to “Configuring PHP: --with-extension or --enable-extension?”

  • No Comments

Leave a Reply