diff --git a/downloads-get-instructions.php b/downloads-get-instructions.php new file mode 100644 index 0000000000..768600cee4 --- /dev/null +++ b/downloads-get-instructions.php @@ -0,0 +1,97 @@ + '@8.4', + 'php83' => '@8.3', + 'php82' => '@8.2', + 'php81' => '@8.1', + default => '' + }; + + $versionDir = match($_GET['version']) { + 'php84' => '8.4', + 'php83' => '8.3', + 'php82' => '8.2', + 'php81' => '8.1', + default => '8.4' + }; + + echo << + On the OSX command line shell, enter: +

+
+brew install php{$version}
+
+

+To enable PHP in Apache add the following to httpd.conf and restart Apache: +

+
+LoadModule php_module \$HOMEBREW_PREFIX/opt/php/lib/httpd/modules/libphp.so
+
+<FilesMatch \.php$>
+SetHandler application/x-httpd-php
+</FilesMatch>
+
+

+Finally, check DirectoryIndex includes index.php +

+
+DirectoryIndex index.php index.html
+
+

+The php.ini and php-fpm.ini file can be found in: +

+
+\$HOMEBREW_PREFIX/etc/php/{$versionDir}/
+
+

+ENDOSX; + return; +} +?> + + On the command line shell, enter: +

+
+sudo apt-get update
+sudo apt-get install php
+
+ENDAPT; + } else { + $version = match($_GET['version']) { + 'php84' => '8.4', + 'php83' => '8.3', + 'php82' => '8.2', + 'php81' => '8.1', + default => '8.4' + }; + echo << + On the command line shell, enter: +

+
+sudo apt -y install software-properties-common
+sudo add-apt-repository ppa:ondrej/php
+sudo apt update
+sudo apt install php{$version}
+
+ENDAPT; + } + return; +} +?> +

+There are no instructions yet. +

+ + diff --git a/downloads.php b/downloads.php index 5468da840f..ad5a1a118e 100644 --- a/downloads.php +++ b/downloads.php @@ -7,8 +7,6 @@ // Try to make this page non-cached header_nocache(); -$SHOW_COUNT = 4; - $SIDEBAR_DATA = '
Supported Versions @@ -37,15 +35,85 @@ ], ], "current" => "downloads", + "js_files" => [ + "/js/version-choice.js", + ], ], ); + +function option(string $id, string $value, string $desc) +{ + $selected = ''; + if (array_key_exists($id, $_GET) && $_GET[$id] === $value) { + $selected = ' selected'; + } + + echo <<{$desc} + +ENDOPT; +} ?>

Downloads & Installation Instructions

+
+Get PHP for + + + + +to work on + + +with + + + + +
+ +I want to have multiple versions at the same time: + + +
+ +

Instructions

+
+ +
+ +

Binaries

@@ -66,49 +134,7 @@

Source Code

- $major_releases): /* major releases loop start */ - $releases = array_slice($major_releases, 0, $SHOW_COUNT); -?> - - $a): ?> - - - -

- - PHP - (Changelog) -

-
- -
    - -
  • - - - ', $rel['md5'], ''; - if (isset($rel['sha256'])) echo '', $rel['sha256'], ''; - ?> - -

    - Note: - -

    - -
  • - -
  • - - Windows downloads - -
  • -
- - GPG Keys for PHP -
- - +

GPG Keys

diff --git a/include/header.inc b/include/header.inc index 2f33d64c55..4ba558fb17 100644 --- a/include/header.inc +++ b/include/header.inc @@ -23,6 +23,13 @@ foreach($css_files as $filename) { $CSS[$filename] = @filemtime($path); } +if (isset($config["js_files"])) { + foreach($config['js_files'] as $filename) { + $path = dirname(__DIR__) . $filename; + $JS[$filename] = @filemtime($path); + } +} + if (isset($shortname) && $shortname) { header("Link: <$shorturl>; rel=shorturl"); } @@ -85,6 +92,10 @@ if (!isset($config["languages"])) { + $modified): ?> + + + "> diff --git a/include/version.inc b/include/version.inc index fccf77370e..4ba37501a5 100644 --- a/include/version.inc +++ b/include/version.inc @@ -107,3 +107,55 @@ function release_get_latest() { return [$version, $current]; } + +function show_source_releases() +{ + global $RELEASES; + + $SHOW_COUNT = 4; + + $i = 0; foreach ($RELEASES as $MAJOR => $major_releases): /* major releases loop start */ + $releases = array_slice($major_releases, 0, $SHOW_COUNT); +?> + + $a): ?> + + + +

+ + PHP + (Changelog) +

+
+ +
    + +
  • + + + ', $rel['md5'], ''; + if (isset($rel['sha256'])) echo '', $rel['sha256'], ''; + ?> + +

    + Note: + +

    + +
  • + +
  • + + Windows downloads + +
  • +
+ + GPG Keys for PHP +
+ + + { + if (response.ok) { + return response.text() + } else { + throw new Error("Couldn't fetch instructions"); + } + }) + .then(data => { + instructionsDiv.innerHTML = data + }) + .catch(error => console.error("Couldn't fetch instructions: ", error)); +} + +function setSelectOsBoxes() { + let osSelector = document.getElementById("os") + let variantSelector = document.getElementById("osvariant") + + for (var i = variantSelector.length - 1; i >= 0; i--) { + if (!variantSelector.options[i].value.startsWith(osSelector.options[osSelector.selectedIndex].value + "-")) { + variantSelector.options[i].disabled = true + } else { + variantSelector.options[i].disabled = false + variantSelector.selectedIndex = i + } + } + + setSelectBoxes(); +} + +window.onload = function() { + let osSelector = document.getElementById("os") + let variantSelector = document.getElementById("osvariant") + let usageSelector = document.getElementById("usage") + let versionSelector = document.getElementById("version") + let multiversionBox = document.getElementById("multiversion") + + osSelector.addEventListener("change", setSelectOsBoxes) + variantSelector.addEventListener("change", setSelectBoxes) + usageSelector.addEventListener("change", setSelectBoxes) + versionSelector.addEventListener("change", setSelectBoxes) + multiversionBox.addEventListener("change", setSelectBoxes) + + setSelectOsBoxes() +}