Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How was my running php compiled?

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?

like image 218
Al_ Avatar asked Mar 02 '12 13:03

Al_


1 Answers

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

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

A list of popular ubuntu version and corresponding package:

  • Ubuntu 18.04: php7.2-dev
  • Ubuntu 20.04: php7.4-dev
  • Ubuntu 21.04: php7.4-dev
  • Ubuntu 21.10: php8.0-dev
  • Ubuntu 22.04*¹: php8.1-dev

*¹ Jammy Jellyfish, scheduled to be release as 22.04

like image 119
Aron Cederholm Avatar answered Oct 26 '22 03:10

Aron Cederholm