Commit a082f1211aa for php
commit a082f1211aa417096372dbca4b8d207308563e18
Author: Daniel Scherzer <daniel.e.scherzer+phpf@gmail.com>
Date: Wed Sep 9 11:39:18 2026 -0700
Persist the `pear/install-pear-nozlib.phar` file
Rather than downloading it as part of the `makedist` script, add the script to
the project's version control. The installation instructions are updated to
indicate that the needed phar script is always present, and the only thing
needed is to become the superuser and run `make install-pear`.
The phar is currently marked as binary in the git attributes since it is not
entirely text, it is committed as-is from the pear server and can be cleaned up
in future commits.
This also fixes the installation process when previously the installation would
try to fallback to the `fetch.php` helper - it seems that the https stream
wrapper is not included in PHP by default. Now that the phar is committed to
version control, the `fetch.php` helper script is no longer needed. After this
patch, `./configure --with-pear --enable-xml` allows installing pear with
`make` without additional manual actions.
diff --git a/.gitattributes b/.gitattributes
index f8b91505bc9..0fec00026fd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -26,3 +26,6 @@
# The OSS fuzz files are bunary
/ext/date/tests/ossfuzz*.txt binary
+
+# The phar has some binary
+/pear/install-pear-nozlib.phar binary
diff --git a/.gitignore b/.gitignore
index 49acc9f2e17..0e3edde1be9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -125,7 +125,6 @@ config.h.in
# ------------------------------------------------------------------------------
/ext/phar/phar.phar
/ext/phar/phar.php
-/pear/install-pear-nozlib.phar
/sapi/cgi/php-cgi
/sapi/fpm/php-fpm
/sapi/phpdbg/phpdbg
diff --git a/pear/Makefile.frag b/pear/Makefile.frag
index 9408757a3ad..366ad4a9575 100644
--- a/pear/Makefile.frag
+++ b/pear/Makefile.frag
@@ -3,11 +3,8 @@ peardir=$(PEAR_INSTALLDIR)
# Skip all php.ini files altogether
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 -ddetect_unicode=0
-WGET = `which wget 2>/dev/null`
-FETCH = `which fetch 2>/dev/null`
PEAR_PREFIX = -dp a${program_prefix}
PEAR_SUFFIX = -ds a$(program_suffix)
-PEAR_INSTALLER_URL = https://pear.php.net/install-pear-nozlib.phar
install-pear-installer: $(SAPI_CLI_PATH)
@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX}
@@ -15,17 +12,7 @@ install-pear-installer: $(SAPI_CLI_PATH)
install-pear:
@echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/"
@if test ! -f $(builddir)/install-pear-nozlib.phar; then \
- if test -f $(srcdir)/install-pear-nozlib.phar; then \
- cp $(srcdir)/install-pear-nozlib.phar $(builddir)/install-pear-nozlib.phar; \
- else \
- if test ! -z "$(WGET)" && test -x "$(WGET)"; then \
- "$(WGET)" "${PEAR_INSTALLER_URL}" -nd -P $(builddir)/; \
- elif test ! -z "$(FETCH)" && test -x "$(FETCH)"; then \
- "$(FETCH)" -o $(builddir)/ "${PEAR_INSTALLER_URL}"; \
- else \
- $(top_builddir)/sapi/cli/php -n $(srcdir)/fetch.php "${PEAR_INSTALLER_URL}" $(builddir)/install-pear-nozlib.phar; \
- fi \
- fi \
+ cp $(srcdir)/install-pear-nozlib.phar $(builddir)/install-pear-nozlib.phar; \
fi
@if test -f $(builddir)/install-pear-nozlib.phar && $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
$(MAKE) -s install-pear-installer; \
diff --git a/pear/fetch.php b/pear/fetch.php
deleted file mode 100644
index 56767b62cb7..00000000000
--- a/pear/fetch.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-function usage($argv) {
- echo "Usage:\n";
- printf("\tphp %s <http://example.com/file> <localfile>\n", $argv[0]);
- exit(1);
-}
-
-function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
- static $filesize = null;
-
- switch($notification_code) {
- case STREAM_NOTIFY_RESOLVE:
- case STREAM_NOTIFY_AUTH_REQUIRED:
- case STREAM_NOTIFY_COMPLETED:
- case STREAM_NOTIFY_FAILURE:
- case STREAM_NOTIFY_AUTH_RESULT:
- /* Ignore */
- break;
-
- case STREAM_NOTIFY_REDIRECTED:
- echo "Being redirected to: ", $message, "\n";
- break;
-
- case STREAM_NOTIFY_CONNECT:
- echo "Connected...\n";
- break;
-
- case STREAM_NOTIFY_FILE_SIZE_IS:
- $filesize = $bytes_max;
- echo "Filesize: ", $filesize, "\n";
- break;
-
- case STREAM_NOTIFY_MIME_TYPE_IS:
- echo "Mime-type: ", $message, "\n";
- break;
-
- case STREAM_NOTIFY_PROGRESS:
- if ($bytes_transferred > 0) {
- if (!isset($filesize)) {
- printf("\rUnknown filesize.. %2d kb done..", $bytes_transferred/1024);
- } else {
- $length = (int)(($bytes_transferred/$filesize)*100);
- printf("\r[%-100s] %d%% (%2d/%2d kb)", str_repeat("=", $length). ">", $length, ($bytes_transferred/1024), $filesize/1024);
- }
- }
- break;
- }
-}
-
-isset($argv[1], $argv[2]) or usage($argv);
-
-if (!isset($_ENV['http_proxy'])) {
- $copt = null;
-} else {
- $copt = array(
- 'http' => array(
- 'proxy' => preg_replace('/^http/i', 'tcp', $_ENV['http_proxy']),
- 'request_fulluri' => true,
- ),
- );
-}
-
-$ctx = stream_context_create($copt, array("notification" => "stream_notification_callback"));
-
-$fp = fopen($argv[1], "r", false, $ctx);
-if (is_resource($fp) && file_put_contents($argv[2], $fp)) {
- echo "\nDone!\n";
- exit(0);
-}
-
-$err = error_get_last();
-echo "\nError..\n", $err["message"], "\n";
-exit(1);
diff --git a/pear/install-pear-nozlib.phar b/pear/install-pear-nozlib.phar
new file mode 100644
index 00000000000..fde49385da0
Binary files /dev/null and b/pear/install-pear-nozlib.phar differ
diff --git a/pear/install-pear.txt b/pear/install-pear.txt
index 2005a569972..1d3dc5c7b6a 100644
--- a/pear/install-pear.txt
+++ b/pear/install-pear.txt
@@ -4,9 +4,7 @@
| |
| PEAR: PHP Extension and Application Repository |
| |
-| To install these components, download |
-| https://pear.php.net/install-pear-nozlib.phar to php-src/pear/ |
-| become the superuser and execute: |
+| To install these components, become the superuser and execute: |
| |
| # make install-pear |
+----------------------------------------------------------------------+
diff --git a/scripts/dev/makedist b/scripts/dev/makedist
index c9ad6059004..75ef434967f 100755
--- a/scripts/dev/makedist
+++ b/scripts/dev/makedist
@@ -152,22 +152,9 @@ fi
# Remove not needed files.
rm -rf autom4te.cache/
-# Download PEAR.
-echo ""
-echo "makedist: Attempting to download PEAR's phar archive."
-if test ! -x wget; then
- wget https://pear.php.net/install-pear-nozlib.phar -nd -P pear/
- if [ "x$?" != "x0" ]; then
- echo "makedist: PEAR download failed." >&2
- exit 1
- fi
-else
- echo "makedist: Missing wget binary needed for PEAR download." >&2
- exit 1
-fi
-
# Reset the modification and access times of all files to be packaged.
commitDate="$(git log -1 --format=%cI $treeish)"
+echo ""
echo "makedist: Resetting the modification and access times of package files to $commitDate"
touch -c -d"$commitDate" NEWS
find . -exec touch -r NEWS -c {} \;