Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128285 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id A565C1A00BC for ; Tue, 29 Jul 2025 07:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753773044; bh=hMTVv1VrbuTAYAgPv+vTHOxhWThe8bzBhk2JaVAjpGA=; h=From:Date:Subject:To:From; b=WHjmSUHkh+fh4MEb+iDt0qxQ4Zn7gWkW01Re46JrEu1I0Rs7Do8Mh6h7gX5Z1PNYk 7XjNqXN5bgSghg+K9cEoa5kqwtwrwvjO8iVVfC0cFO2ScLvFU9sUeQSmlSEyD+dc3c IKMh+8aY80iRgr8NSYIGmR36ksy+niGyvwYUNJkipi6IYeGbDVem3jC9aFpMMX3kHD 7ECdSIMqCJFFUckjL5V8D+T0d09YxBpS7XfW1gmHYN0aPaWrSRd1xKOGsEYJNRyu0T Hoq84+mKStmZ6p0uRI0OFbIEUZz4kbnpLHHp6moIqSZoUQwMQD78ccRS5BRQ1VZInd 4PqtYOnX4NMgw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 02B0B18006C for ; Tue, 29 Jul 2025 07:10:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Jul 2025 07:10:43 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-31c4a546cc2so4468869a91.2 for ; Tue, 29 Jul 2025 00:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753773145; x=1754377945; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=8kgF1XHwEgjDAe1yTK5EjkgkdRFji6KKKOqLEXi45wQ=; b=FoeImqsh/cTFTdESiHUd798UcVIbQuT7D30VFFq4G/V5ev+2rYs2wmGpIiu/uU8qiz Bac0sCtelXtu8xZIjNxnRyWyGhA2h2+LBJ3mPy1tEdFY0zhsOhGyeFqlwz49qyxENJ06 L5Xe7Bt3qv2Llm0pb5RgONuNZfuokXQEhHc1Ba8tyZFEwNv0WIR+ObCpuOPr25kAQumG MRM98inKcNkfKwVeTgBv/CX4PrUFeIm+FYOlbeQ+bw4kC8YFQZZnaTuJmkCts6eZQcz8 v45cEVDZuaXNgG/8ukDXNSm/WwHaFVl+xJZo84+e/lzZqRnDzg5QBACV7pwC1UyqlGUA qCjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753773145; x=1754377945; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8kgF1XHwEgjDAe1yTK5EjkgkdRFji6KKKOqLEXi45wQ=; b=ce9tNLrBQilyVBPmwPICLtAvjn+l3qBkI6YNsTS5GQgVNaamJ6TEADkcKR5Zcw+VGf 9t1ulNX1jwSaQtyu2V1NknjZvUniM5mNmz9EacyRQFn6xyEo9svOjLw9icIhS/4oUVt0 B8Ikxzy2DCVgWBnLAZSB4PR79iGxBvB6w94lhCgQwlN2a6JVf1d+tmmYhLmtLpLjMs+n okc2ItBG1BDelnkfxz1SvitWvKJ3ukGz6/T36Ck1N6+NTNyAk2IpkPb1++JISd2Kx4e/ +LUNdwRGn1D22TnDGVF3ZFSOb3N179Gwq/8ML2HWtlOUUms0ogeg7b6C7gymOA7e9cGv b4Pw== X-Gm-Message-State: AOJu0YwIXKL1w/gyForWJLAALmBoKnLAx+Z6+eIORVNYPXnb/qERFyLR Ezgrf7AX+u5/32Y9gDTe/OlGEnmOML3Y2TfsXhw2cln30U6ij4LEBj9DG65ow3wLefX9tE23kDC zgK73yiIy2nJmcMERUURQaCfO7hkBbkWyZ1zeFoE= X-Gm-Gg: ASbGncu+npRob+9I3ckZLz9NZiO0CDAquB7XRxUqFstj64zTe4yH43YxiT2WiG1G43q 7y4FI9Vb6Vevrw2+Eokj2AtICDhBi/Es3jkefyMbO3bFZzc/7oCQxQU5SIdU+CCWjY9tdXqX7rQ gGCCIbG8I5EG2I+q6s4wE+AD5JWBS5kQvQlmD0RJRhprp9z5WyTgwW5lxbeJF3hxRYV01WYY0Zo znl16u6 X-Google-Smtp-Source: AGHT+IHzK39xqZ9CvDm3WTMDaeRze88ucOae5zoy4TyIrY1zowuLabitIdXRRf/rRgz1gaAUcAmdT7W3VROB1gPgPJc= X-Received: by 2002:a17:90b:2750:b0:311:ff02:3fcc with SMTP id 98e67ed59e1d1-31e778a0660mr21892792a91.14.1753773145113; Tue, 29 Jul 2025 00:12:25 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 29 Jul 2025 10:12:13 +0300 X-Gm-Features: Ac12FXzmjy_9zTG8dokIvHuNg_8KgOxOvtDAuU56i85W7EIZQEunGTy2JaSSF6w Message-ID: Subject: [PHP-DEV] [DISCUSSION] Json version of PHP Info To: PHP internals Content-Type: multipart/alternative; boundary="00000000000054c6ce063b0c218b" From: xepozzd@gmail.com (Dmitry Derepko) --00000000000054c6ce063b0c218b Content-Type: text/plain; charset="UTF-8" Hi, Internals! I want to have a unified function phpinfo() for any environment. Currently phpinfo works different in CLI and SAPI modes: - SAPI mode enforces the function print HTML tags - CLI mode enforces the function print text as is Here is implementation of the function: https://github.com/xepozz/php-src/blob/5dd9b0dcef229c55f67044537b076c6e4320f28c/ext/standard/info.c#L760 So I'd like to create a separate function phpinfo_json() which will dump pretty much the same text as a json structure. Use-case as simple as absurd: - PHP/php -S serves the content as a SAPI mode - RoadRunner/Queues/Workers which run PHP scripts as `php index.php` run it as CLI mode It's not convenient to see CLI-like output when you run a web server. It's not possible to fetch some info from the function output User should write parsers for both function variations: SAPI and CLI to parse something There is no need to use the output buffers to get the information. New function output could be an array-like structure or a json string. It's open to discuss. I'm okay with any or even both with a flag "$asArray" -- Best regards, Dmitrii Derepko. @xepozz --00000000000054c6ce063b0c218b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, Internals!

I want to hav= e a unified function phpinfo() for any environment.

Currently phpinfo works different in CLI and SAPI modes:
- SAPI= mode enforces the function print HTML tags
- CLI mode enforces t= he function print text as is


So I'd like to create= a separate function phpinfo_json() which will dump pretty much the same te= xt as a json structure.
Use-case as simple as absurd:
-= PHP/php -S serves the content as a SAPI mode
- RoadRunner/Queues= /Workers which run PHP scripts as `php index.php` run it as CLI mode
<= div>
It's not convenient=C2=A0to see CLI-like output when= you run a web server.
It's not possible to fetch some info f= rom the function output
User should write parsers for both functi= on variations: SAPI and CLI to parse something
There is no need t= o use the output buffers to get the information.

N= ew function output could be an array-like structure or a json string. It= 9;s open to discuss. I'm okay with any or even both with a flag "$= asArray"

--=
Best reg= ards,
Dmitrii Derepko.
--00000000000054c6ce063b0c218b--