17

I'm trying to compile a new instance of PHP (5.4.0) from the source code and want to keep compatibility with the one (PHP 5.3.6-13ubuntu3.6) already installed from the distro, Ubuntu-11.10. That is, I want to run ./configure with the same directives as the installed PHP.

I always could see the ./configure command outputted by phpinfo() but this time, for my surprise, it's not provided.

Do you know of any flag that prevent phpinfo of outputting the compile configuration? Or,

Do you know of any other way to get how PHP was compiled?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Al_
  • 1,481
  • 1
  • 11
  • 22

2 Answers2

40

Original answer

There should be a script php-config you can install on ubuntu to get the configure parameters used for php.

sudo apt-get install php5-dev
php-config  --configure-options

2023 Update

The php-config executable is currently present in the generic package phpX.Y-dev, where X and Y is the major and minor version of the php package installed on your system. Also, the name of the executable reflects your php version.

sudo apt-get install php8.1-dev
php-config8.1 --configure-options

A list of popular ubuntu version and corresponding package:

*¹ Lunar Lobster nightly, scheduled to be released as 23.04

Xyz
  • 5,955
  • 5
  • 40
  • 58
  • On Ubunutu 12.04 `php-config` is included in the `php5-dev` package – Nic Mar 29 '13 at 17:19
  • This will update some of the modules or install new ones on my server New `libapache2-mod-php5 libltdl-dev libtool php5-cgi php5-cli php5-common php5-curl php5-gd php5-intl php5-mcrypt php5-mysql php5-pgsql php5-sqlite shtool` Update `libapache2-mod-php5 php5-cgi php5-cli php5-common php5-curl php5-gd php5-intl php5-mcrypt php5-mysql php5-pgsql php5-sqlite` – yunzen Nov 16 '15 at 15:24
10

According to this bug report, the Configure Command output was intentionally suppressed from Ubuntu & Debian PHP builds.

Then recommend installing the source package via apt-get source php5:

If you want to see how PHP is built in Ubuntu, apt-get source php5, and peruse debian/rules, the ./configure output in phpinfo() is, as the changelog for the patch states, entirely misleading and not terribly informative.

Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390