How to See What Configure Options PHP Was Compiled With

By Lowell Heddings on June 27th, 2017

PHP in the repositories comes with tons of modules that aren’t needed, and we’ve always custom-compiled our own version with only the things that we need. But when you’re switching from one server to another, or you want to compile it again and you forgot to save the options, there’s luckily a few easy ways to see the configure options. It’s also really helpful for setting up a local development environment that matches production.

The first method is really simple — make a new PHP page, and just add the following:



Navigate to the page in your browser, and you’ll see a crazy page like this, which has the configure command right there:

Hmm, looks like my local development machine is really out of date. Maybe I should compile a new copy of PHP, huh?

The second option is using the command line, which is way easier. Just type the following on the terminal:

php -i | grep configure

You’ll get all the output from phpinfo but on the command line, and the grep part of the statement searches for just the line that contains the configure command.

And now we’ve successfully completed another silly filler article. When is he gonna write something useful, you ask? I agree.