Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66950 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61287 invoked from network); 4 Apr 2013 16:05:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2013 16:05:52 -0000 X-Host-Fingerprint: 86.14.252.140 cpc3-asfd3-2-0-cust139.1-2.cable.virginmedia.com Received: from [86.14.252.140] ([86.14.252.140:12387] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/65-35962-ED4AD515 for ; Thu, 04 Apr 2013 11:05:50 -0500 To: internals@lists.php.net,Julien Pauli Message-ID: <515DA4DA.2060300@php.net> Date: Thu, 04 Apr 2013 17:05:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 86.14.252.140 Subject: Re: Adding a way to retreive compile options at runtime From: krakjoe@php.net (Joe Watkins) On 04/04/2013 03:18 PM, Julien Pauli wrote: > Hello everybody, > > Today we talked about a way to detect --with-curlwrappers at runtime. > It is nowadays not possible easilly. > > Then , I remembered I once proposed to add a new function that could return > every ./configure options used to compile the runtime PHP the code is > beeing run on. > > We already have "php-config --configure-options", but that needs to exist > and that needs an exec() call. > We also already have phpinfo() which returns that, but not in a very fancy > way (we need to preg_ the output which is ugly and not very simple). > > Today, Seldaek proposed what I think is a cool way to solve this problem : > add a new parameter to phpinfo() function, which could return in an array > what it usually directly print throught the SAPI print() function (HTMLing > the output when needed). > > The use case would be : > > $output = phpinfo(INFO_GENERAL, true); > > var_dump($output); > /* something like > ['Debug Build' =>'no', 'Thread Safety'=>'yes', 'Configure > Command'=>['--enable-foo', '--with-config-file-scan-dir'=>'/etc' > ]] > > > As you can see, it is rather simple but would need some work as it is > better for the "Configure Command" to return an array with the options > instead of a big string ; easier to parse. > > Thoughts ? > > Julien.Pauli > Seems like a good idea to me ... So ... https://gist.github.com/krakjoe/5311608 Array ( [with-apxs2] => /opt/php-nts/bin/apxs [prefix] => /opt/php-nts [exec-prefix] => /opt/php-nts [with-config-file-path] => /opt/php-nts/ [with-config-file-scan-dir] => /opt/php-nts/modules.d/ [with-curl] => /usr [with-zlib] => 1 [with-libxml-dir] => /usr [enable-simplexml] => 1 [with-mysql] => mysqlnd [with-pdo-mysql] => mysqlnd [enable-gd-native-ttf] => 1 [with-mysqli] => 1 [enable-sockets] => 1 [with-gd] => 1 [enable-debug] => 1 ) Something that hasn't been mentioned, installation of software like wordpress or whatever, might be able to offer advice to the end user based on the configuration defaults, regardless of ini settings. Joe