Page 1 of 1

Retrieve Configure Command Line From an Existing Install

Posted: Tue Jun 19, 2007 5:19 am
by Ollie Saunders
How might one go about retrieving the configure command line that was used in the creation of an existing install?
I've found that print_r(get_defined_constants()) gives me a few things and I've started putting together an configure line

Code: Select all

./configure --with-apxs2=/usr/bin/apxs2
            --prefix=/usr
            --sysconfdir=/usr/etc
            --libdir=/usr/lib/php5
            --datadir=/usr/share/php5
            --with-mysql
Second question: Below is a list of select configure lines that you can use. Do I have to specify all of these and there "DIR"s or can the DIRs be ommited and PHP left to detect them?

Code: Select all

--with-libxml-dir[=DIR] libxml2 install prefix
  --with-openssl[=DIR]    Include OpenSSL support (requires OpenSSL >= 0.9.6)
  --with-zlib[=DIR]       Include ZLIB support (requires zlib >= 1.0.9)
  --with-zlib-dir=<DIR>   Define the location of zlib install directory
  --with-curl[=DIR]       Include cURL support
  --with-libxml-dir[=DIR]   DOM: libxml2 install prefix
  --with-gd[=DIR]         Include GD support where DIR is GD install prefix.
                          If DIR is not set, the bundled GD library will be used
  --with-jpeg-dir[=DIR]     GD: Set the path to libjpeg install prefix
  --with-png-dir[=DIR]      GD: Set the path to libpng install prefix
  --with-zlib-dir[=DIR]     GD: Set the path to libz install prefix
  --with-xpm-dir[=DIR]      GD: Set the path to libXpm install prefix
  --with-ttf[=DIR]          GD: Include FreeType 1.x support
  --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
  --with-t1lib[=DIR]        GD: Include T1lib support. T1lib version >= 5.0.0 required
  --enable-gd-native-ttf    GD: Enable TrueType string function
  --enable-gd-jis-conv      GD: Enable JIS-mapped Japanese font support
  --with-gettext[=DIR]    Include GNU gettext support
  --with-mcrypt[=DIR]     Include mcrypt support
  --with-mhash[=DIR]      Include mhash support
  --with-mysql[=DIR]      Include MySQL support. DIR is the MySQL base directory
  --with-pdo-mysql[=DIR]    PDO: MySQL support. DIR is the MySQL base directory
  --with-mm[=DIR]           SESSION: Include mm support for session storage
  --with-openssl-dir[=DIR]  SNMP: openssl install prefix
  --with-xsl[=DIR]        Include new XSL support (requires libxslt >= 1.1.0).
                          DIR is the libxslt install directory
  --with-pear=DIR         Install PEAR in DIR [PREFIX/lib/php]

Posted: Tue Jun 19, 2007 6:00 am
by jamiel
php -i | grep configure

Posted: Tue Jun 19, 2007 6:01 am
by jamiel
Most PHP will be able to detect. You only have to specify the dirs if your configure is failing to give it a bit of help.

Posted: Tue Jun 19, 2007 6:03 am
by Ollie Saunders
Great thanks

Posted: Tue Jun 19, 2007 9:48 am
by Ollie Saunders
jamiel wrote:php -i | grep configure
Hang on that's not so great. I get no output. php -i just tells me what phpinfo() did.

Posted: Tue Jun 19, 2007 6:43 pm
by volka
ole wrote:I get no output
none?
Try

Code: Select all

php -i | grep Configure
so it matches
Configure Command => './configure'
in the output of php -i

Posted: Thu Jun 21, 2007 6:36 pm
by Ollie Saunders
the word configure does not appear in the output of "php -i"

Posted: Thu Jun 21, 2007 7:33 pm
by volka
strange. But System, Build Date and Server API are printed by php -i ?

what's the output of

Code: Select all

<?php
echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname(), "<br />\n";
and where did you get this version of php?

Posted: Fri Jun 22, 2007 3:08 am
by Ollie Saunders
Top of Phpinfo wrote:phpinfo()
PHP Version => 5.1.2

System => Linux dev 2.6.15-28-amd64-server #1 SMP Thu Feb 1 16:32:07 UTC 2007 x86_64
Build Date => May 22 2007 20:27:29
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli/php.ini
PHP API => 20041225
PHP Extension => 20050922
Zend Extension => 220051025
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, co
nvert.*, convert.iconv.*, bzip2.*, zlib.*


This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Code: Select all

root@dev:~# php -r "echo phpversion(), ' ', php_uname(), chr(10);"
5.1.2 Linux dev 2.6.15-28-amd64-server #1 SMP Thu Feb 1 16:32:07 UTC 2007 x86_64
and where did you get this version of php?
that's a good point actually because I got this by ticking the LAMP option when installing ubuntu server.

Posted: Fri Jun 22, 2007 5:36 am
by volka
http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_5.1.2-1ubuntu3.8.diff.gz wrote:+php4 (4:4.3.11-1) unstable; urgency=low
...
+ * Add 052-phpinfo_no_configure.patch, which disables the display of our
+ "Configure Command" in phpinfo()
, which was the source of many bogus
+ bug reports over the years, due to people misinterpreting its meaning.
[...]
+ -- Adam Conrad <adconrad@0c3.net> Mon, 4 Jul 2005 17:47:32 +1000
(ubuntu is based on debian and the debian diff file contains the the same patch)

Posted: Fri Jun 22, 2007 5:46 am
by Ollie Saunders
volka wrote:
http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_5.1.2-1ubuntu3.8.diff.gz wrote:+php4 (4:4.3.11-1) unstable; urgency=low
...
+ * Add 052-phpinfo_no_configure.patch, which disables the display of our
+ "Configure Command" in phpinfo()
, which was the source of many bogus
+ bug reports over the years, due to people misinterpreting its meaning.
[...]
+ -- Adam Conrad <adconrad@0c3.net> Mon, 4 Jul 2005 17:47:32 +1000
(ubuntu is based on debian and the debian diff file contains the the same patch)
heheh that's funny. But also quite annoying. Anybody have any other ideas how I find out this information? Perhaps I can unpatch the patch somehow.

Posted: Fri Jun 22, 2007 6:22 am
by volka
ole wrote:Perhaps I can unpatch the patch somehow.
You probably could but 'm too unfamiliar with the debian build process to assist you.
You had to get rid of
--- php5-5.1.2.orig/debian/patches/052-phpinfo_no_configure.patch
+++ php5-5.1.2/debian/patches/052-phpinfo_no_configure.patch
@@ -0,0 +1,11 @@
+--- php4-4.3.11/ext/standard/info.c.orig 2005-07-10 06:23:11.000000000 +1000
++++ php4-4.3.11/ext/standard/info.c 2005-07-10 06:23:33.000000000 +1000
+@@ -443,7 +443,7 @@
+ php_info_print_table_start();
+ php_info_print_table_row(2, "System", php_uname );
+ php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ );
+-#ifdef CONFIGURE_COMMAND
++#if 0
+ php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
+ #endif
+ if (sapi_module.pretty_name) {
(the #if 0 removes the output) in the diff file and then rebuild (with the debian/ubuntu build-system!) and reinstall the php package

the configure options are also in that diff file, e.g.
COMMON_CONFIG= --build=$(PHP5_BUILD_GNU_TYPE)-gnu --host=$(PHP5_HOST_GNU_TYPE)-gnu \
+ --mandir=/usr/share/man \
+ --enable-memory-limit \
+ --disable-debug \
+ --with-regex=php \
+ --disable-rpath \
+ --disable-static \
+ --with-pic \
+ --with-layout=GNU \
+ --with-pear=/usr/share/php \
+ --enable-calendar \
+ --enable-sysvsem \
+ --enable-sysvshm \
+ --enable-sysvmsg \
+ --enable-track-vars \
+ --enable-trans-sid \
+ --enable-bcmath \
+ --with-bz2 \
+ --enable-ctype \
+ --with-db4 \
+ --with-gdbm=/usr \
+ --with-iconv \
+ --enable-exif \
+ --enable-filepro \
+ --enable-ftp \
+ --with-gettext \
+ --enable-mbstring \
+ --with-pcre-regex=/usr \
+ --enable-shmop \
+ --enable-sockets \
+ --enable-wddx \
+ --with-libxml-dir=/usr \
+ --enable-yp \
+ --with-zlib \
+ --with-kerberos=/usr \
+ --with-openssl=/usr \
+ --enable-dbx \
+ --disable-pdo \
+ --enable-soap \
+ --with-mime-magic=$(MAGIC_MIME) \
+ --with-exec-dir=/usr/lib/php5/libexec
and the apache2 build seems to use
+configure-apache2-stamp: patch-stamp
+ dh_testdir
+ if [ -d apache2-build ]; then rm -rf apache2-build; fi
+ -mkdir apache2-build
+ cd apache2-build && \
+ CFLAGS="$(CFLAGS)" PROG_SENDMAIL="$(PROG_SENDMAIL)" ../configure \
+ --prefix=/usr --with-apxs2=/usr/bin/apxs2 \
+ --with-config-file-path=/etc/php5/apache2 \
+ $(COMMON_CONFIG) \
+ --without-mm \
+ --with-curl=shared,/usr \
+ --with-zlib-dir=/usr \
+ --with-gd=shared,/usr --enable-gd-native-ttf \
+ --with-jpeg-dir=shared,/usr \
+ --with-xpm-dir=shared,/usr/X11R6 \
+ --with-png-dir=shared,/usr \
+ --with-freetype-dir=shared,/usr \
+ --with-ttf=shared,/usr \
+ --with-t1lib=shared,/usr \
+ --with-ldap=shared,/usr \
+ --with-mhash=shared,/usr \
+ --with-mysql=shared,/usr \
+ --with-mysqli=shared,/usr/bin/mysql_config \
+ --with-unixODBC=shared,/usr \
+ --with-recode=shared,/usr \
+ --with-xsl=shared,/usr \
+ --with-snmp=shared,/usr \
+ --with-sqlite=shared,/usr \
+ --with-sybase-ct=shared,/usr \
+ --with-xmlrpc=shared \
+ --with-pgsql=shared,/usr

Why do you want to know the configure command?

Posted: Fri Jun 22, 2007 7:37 am
by Ollie Saunders
Thanks volka, you have been extraordinarily helpful with your experience in areas that I do not possess.
Why do you want to know the configure command?
Because I'd like to build PHP from source but maintain everything good I like about the packaged build. So I want to start from the package build as a base.

Posted: Fri Jun 22, 2007 8:45 am
by volka
Then I suggest that you get acquainted with the debian build system. This way you can re-use the existing source package, change what you want and need and then build a new php binary package.
I ...think http://www.debian.org/doc/devel-manuals#maint-guide might be interesting