Author: Derick Rethans (derickr) Date: 2025-07-21T16:19:18+01:00 Commit: https://github.com/php/web-php/commit/c13c88ffd53367141e8713bf6f0e31bd3d441d13 Raw diff: https://github.com/php/web-php/commit/c13c88ffd53367141e8713bf6f0e31bd3d441d13.diff
Re-do logic according to Shivam's instructions, and add instructions to repo Changed paths: A include/download-instructions/fw-drupal.php A include/download-instructions/fw-laravel.php A include/download-instructions/fw-symfony.php A include/download-instructions/fw-wordpress.php A include/download-instructions/linux-debian-cli-community.php A include/download-instructions/linux-debian-cli-default.php A include/download-instructions/linux-debian-web-community.php A include/download-instructions/linux-debian-web-default.php A include/download-instructions/linux-fedora-cli-community.php A include/download-instructions/linux-fedora-cli-default.php A include/download-instructions/linux-fedora-web-community.php A include/download-instructions/linux-fedora-web-default.php A include/download-instructions/linux-ubuntu-cli-community.php A include/download-instructions/linux-ubuntu-cli-default.php A include/download-instructions/linux-ubuntu-web-community.php A include/download-instructions/linux-ubuntu-web-default.php A include/download-instructions/osx-homebrew-php.php A include/download-instructions/osx-homebrew.php A include/download-instructions/osx-macports.php A include/download-instructions/windows-chocolatey.php A include/download-instructions/windows-native.php A include/download-instructions/windows-scoop.php M downloads-get-instructions.php M downloads.php Diff: diff --git a/downloads-get-instructions.php b/downloads-get-instructions.php index e8149d3196..67c663373c 100644 --- a/downloads-get-instructions.php +++ b/downloads-get-instructions.php @@ -1,97 +1,60 @@ <?php -if ($options['os'] === 'windows' && $options['osvariant'] === 'windows-wsl') { - $options['os'] = 'linux'; - $options['osvariant'] = 'linux-deb-bookworm'; - $options['multiversion'] = 'true'; +$file = 'unknown'; +$latestPhpVersion = '8.4'; + +if ($options['os'] === 'windows') { + if ($options['osvariant'] === 'windows-wsl-debian') { + $options['os'] = 'linux'; + $options['osvariant'] = 'linux-debian'; + } + if ($options['osvariant'] === 'windows-wsl-ubuntu') { + $options['os'] = 'linux'; + $options['osvariant'] = 'linux-ubuntu'; + } } if ($options['os'] === 'osx') { - $version = match($options['version']) { - 'php84' => '@8.4', - 'php83' => '@8.3', - 'php82' => '@8.2', - 'php81' => '@8.1', - default => '' - }; + if ($options['version'] === 'default') { + $options['version'] = $latestPhpVersion; + } +} - $versionDir = match($options['version']) { - 'php84' => '8.4', - 'php83' => '8.3', - 'php82' => '8.2', - 'php81' => '8.1', - default => '8.4' - }; +if (in_array($options['usage'], ['fw-drupal', 'fw-laravel', 'fw-symfony', 'fw-wordpress'])) { + $file = "{$options['usage']}"; + $options['os'] = null; +} - echo <<<ENDOSX -<p> - On the OSX command line shell, enter: -</p> -<div class="phpcode"><pre> -brew install php{$version} -</pre></div> -<p> -To enable PHP in Apache add the following to httpd.conf and restart Apache: -</p> -<div class="phpcode"><pre> -LoadModule php_module \$HOMEBREW_PREFIX/opt/php/lib/httpd/modules/libphp.so +$multiversion = false; -<FilesMatch \.php$> -SetHandler application/x-httpd-php -</FilesMatch> -</pre></div> -<p> -Finally, check DirectoryIndex includes index.php -</p> -<div class="phpcode"><pre> -DirectoryIndex index.php index.html -</pre></div> -<p> -The php.ini and php-fpm.ini file can be found in: -</p> -<div class="phpcode"><pre> -\$HOMEBREW_PREFIX/etc/php/{$versionDir}/ -</pre></div> -</p> -ENDOSX; - return; +if (array_key_exists('multiversion', $options)) { + $multiversion = $options['multiversion'] === 'Y'; } + +switch ($options['os']) { + case 'linux': + $defaultOrCommunity = ($options['version'] !== 'default' || $multiversion) ? 'community' : 'default'; + if ($defaultOrCommunity === 'community' && $options['version'] == 'default') { + $options['version'] = $latestPhpVersion; + } + $file = "{$options['osvariant']}-{$options['usage']}-{$defaultOrCommunity}"; + break; + case 'osx': + case 'windows': + $file = "{$options['osvariant']}"; + break; +} + +$version = $options['version']; +$versionNoDot = str_replace('.', '', $version); + +if (file_exists(__DIR__ . "/include/download-instructions/{$file}.php")) { + include __DIR__ . "/include/download-instructions/{$file}.php"; + return true; +} else { ?> -<?php -if ($options['os'] === 'linux' && str_starts_with($options['osvariant'], 'linux-deb')) { - if ($options['version'] === 'default' && $options['multiversion'] != 'true') { - echo <<<ENDAPT <p> - On the command line shell, enter: +There are no instructions yet. Try using the generic installation from source. </p> -<div class="phpcode"><pre> -sudo apt-get update -sudo apt-get install php -</pre></div> -ENDAPT; - } else { - $version = match($options['version']) { - 'php84' => '8.4', - 'php83' => '8.3', - 'php82' => '8.2', - 'php81' => '8.1', - default => '8.4' - }; - echo <<<ENDAPT -<p> - On the command line shell, enter: -</p> -<div class="phpcode"><pre> -sudo apt -y install software-properties-common -sudo add-apt-repository ppa:ondrej/php -sudo apt update -sudo apt install php{$version} -</pre></div> -ENDAPT; - } - return; +<?php + return false; } ?> -<p> -There are no instructions yet. -</p> - -<?php var_dump($options); ?> diff --git a/downloads.php b/downloads.php index 7c966724fc..d6b13e2147 100644 --- a/downloads.php +++ b/downloads.php @@ -56,40 +56,43 @@ function option(string $value, string $desc, $attributes = []): string 'linux' => [ 'name' => 'Linux', 'variants' => [ - 'linux-deb-buster' => 'Debian Buster', - 'linux-deb-bullseye' => 'Debian Bullseye', - 'linux-deb-bookworm' => 'Debian Bookworm', - 'linux-rpm-fedora41' => 'Fedora 41', - 'linux-rpm-fedora42' => 'Fedora 42', - 'linux-rpm-redhat' => 'RedHat', + 'linux-debian' => 'Debian', + 'linux-fedora' => 'Fedora', + 'linux-redhat' => 'RedHat', + 'linux-ubuntu' => 'Ubuntu', ], ], 'osx' => [ 'name' => 'macOS', 'variants' => [ - 'osx-latest' => 'macOS Latest', + 'osx-homebrew' => 'Homebrew/Brew', + 'osx-homebrew-php' => 'Homebrew/Homebrew-PHP', + 'osx-macports' => 'MacPorts', ], ], 'windows' => [ 'name' => 'Windows', 'variants' => [ - 'windows-wsl' => 'Windows with WSL', - 'windows-normal' => 'Windows without WSL', + 'windows-native' => 'Windows Native Build', + 'windows-chocolatey' => 'Windows with Chocolatey', + 'windows-scoop' => 'Windows with Scoop', + 'windows-wsl-debian' => 'Windows with WSL/Debian', + 'windows-wsl-ubuntu' => 'Windows with WSL/Ubuntu', ], ], ]; $versions = [ - 'php84' => 'version 8.4', - 'php83' => 'version 8.3', - 'php82' => 'version 8.2', - 'php81' => 'version 8.1', + '8.4' => 'version 8.4', + '8.3' => 'version 8.3', + '8.2' => 'version 8.2', + '8.1' => 'version 8.1', 'default' => 'OS default version', ]; $defaults = [ 'os' => 'linux', - 'version' => 'php84', + 'version' => 'default', 'usage' => 'web', ]; @@ -160,26 +163,10 @@ function option(string $value, string $desc, $attributes = []): string <h2>Instructions</h2> <div id="instructions" class="instructions"> -<?php include 'downloads-get-instructions.php'; ?> +<?php $instructionsShown = include 'downloads-get-instructions.php'; ?> </div> -<h2>Binaries</h2> - -<p> - <a href="https://windows.php.net/download/">Binaries are available for - Microsoft Windows</a>. The PHP project does not currently release binary packages - for other platforms such as Linux or macOS, but they are packaged by distributions - and other providers. For more information, see: - - <ul> - <li> - <a href="/manual/install.unix.php">Installation instructions for Unix systems</a> - </li> - <li> - <a href="/manual/install.macosx.php">Installation instructions for macOS</a> - </li> - </ul> -</p> +<?php if (!$instructionsShown): ?> <h2>Source Code</h2> <?php show_source_releases(); ?> @@ -201,6 +188,26 @@ function option(string $value, string $desc, $attributes = []): string </a> </p> +<h2>Binaries</h2> + +<p> + <a href="https://windows.php.net/download/">Binaries are available for + Microsoft Windows</a>. The PHP project does not currently release binary packages + for other platforms such as Linux or macOS, but they are packaged by distributions + and other providers. For more information, see: + + <ul> + <li> + <a href="/manual/install.unix.php">Installation instructions for Unix systems</a> + </li> + <li> + <a href="/manual/install.macosx.php">Installation instructions for macOS</a> + </li> + </ul> +</p> + +<?php endif; ?> + <script> window.onload = function () { let form = document.getElementById("instructions-form") diff --git a/include/download-instructions/fw-drupal.php b/include/download-instructions/fw-drupal.php new file mode 100644 index 0000000000..20ff7332ae --- /dev/null +++ b/include/download-instructions/fw-drupal.php @@ -0,0 +1,6 @@ +<p> +Instructions for installing PHP for Drupal development can be found on: +</p> +<p> +» <a href='https://www.drupal.org/docs/getting-started/installing-drupal'>https://www.drupal.org/docs/getting-started/installing-drupal</a> +</p> diff --git a/include/download-instructions/fw-laravel.php b/include/download-instructions/fw-laravel.php new file mode 100644 index 0000000000..62c4282b6a --- /dev/null +++ b/include/download-instructions/fw-laravel.php @@ -0,0 +1,6 @@ +<p> +Instructions for installing PHP for Laravel development can be found on: +</p> +<p> +» <a href='https://laravel.com/docs/12.x/installation#installing-php'>https://laravel.com/docs/12.x/installation#installing-php</a> +</p> diff --git a/include/download-instructions/fw-symfony.php b/include/download-instructions/fw-symfony.php new file mode 100644 index 0000000000..f03259972f --- /dev/null +++ b/include/download-instructions/fw-symfony.php @@ -0,0 +1,6 @@ +<p> +Instructions for installing PHP for Symfony development can be found on: +</p> +<p> +» <a href='https://symfony.com/doc/current/setup.html'>https://symfony.com/doc/current/setup.html</a> +</p> diff --git a/include/download-instructions/fw-wordpress.php b/include/download-instructions/fw-wordpress.php new file mode 100644 index 0000000000..1fd289f75d --- /dev/null +++ b/include/download-instructions/fw-wordpress.php @@ -0,0 +1,6 @@ +<p> +Instructions for installing PHP for WordPress development can be found on: +</p> +<p> +» <a href='https://wordpress.org/support/article/how-to-install-wordpress/'>https://wordpress.org/support/article/how-to-install-wordpress/</a> +</p> diff --git a/include/download-instructions/linux-debian-cli-community.php b/include/download-instructions/linux-debian-cli-community.php new file mode 100644 index 0000000000..e6c6f3c5d7 --- /dev/null +++ b/include/download-instructions/linux-debian-cli-community.php @@ -0,0 +1,12 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo apt-get update +sudo apt-get install -y lsb-release ca-certificates apt-transport-https curl +sudo curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb +sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb +sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' +sudo apt-get update +sudo apt-get install -y php<?= $version; ?> +</pre> diff --git a/include/download-instructions/linux-debian-cli-default.php b/include/download-instructions/linux-debian-cli-default.php new file mode 100644 index 0000000000..ce0b0e3513 --- /dev/null +++ b/include/download-instructions/linux-debian-cli-default.php @@ -0,0 +1,7 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo apt update +sudo apt install -y php +</pre> diff --git a/include/download-instructions/linux-debian-web-community.php b/include/download-instructions/linux-debian-web-community.php new file mode 120000 index 0000000000..b21d40f00c --- /dev/null +++ b/include/download-instructions/linux-debian-web-community.php @@ -0,0 +1 @@ +linux-debian-cli-community.php \ No newline at end of file diff --git a/include/download-instructions/linux-debian-web-default.php b/include/download-instructions/linux-debian-web-default.php new file mode 120000 index 0000000000..0017979f66 --- /dev/null +++ b/include/download-instructions/linux-debian-web-default.php @@ -0,0 +1 @@ +linux-debian-cli-default.php \ No newline at end of file diff --git a/include/download-instructions/linux-fedora-cli-community.php b/include/download-instructions/linux-fedora-cli-community.php new file mode 100644 index 0000000000..a436d5ec0f --- /dev/null +++ b/include/download-instructions/linux-fedora-cli-community.php @@ -0,0 +1,10 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo dnf install -y dnf-plugins-core +sudo dnf install -y https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm +sudo dnf module reset php -y +sudo dnf module enable php:remi-<?= $version; ?> -y +sudo dnf install -y php +</pre> diff --git a/include/download-instructions/linux-fedora-cli-default.php b/include/download-instructions/linux-fedora-cli-default.php new file mode 100644 index 0000000000..a1c27d60fd --- /dev/null +++ b/include/download-instructions/linux-fedora-cli-default.php @@ -0,0 +1,6 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo dnf install -y php +</pre> diff --git a/include/download-instructions/linux-fedora-web-community.php b/include/download-instructions/linux-fedora-web-community.php new file mode 120000 index 0000000000..96f87a049c --- /dev/null +++ b/include/download-instructions/linux-fedora-web-community.php @@ -0,0 +1 @@ +linux-fedora-cli-community.php \ No newline at end of file diff --git a/include/download-instructions/linux-fedora-web-default.php b/include/download-instructions/linux-fedora-web-default.php new file mode 120000 index 0000000000..83c945fbe5 --- /dev/null +++ b/include/download-instructions/linux-fedora-web-default.php @@ -0,0 +1 @@ +linux-fedora-cli-default.php \ No newline at end of file diff --git a/include/download-instructions/linux-ubuntu-cli-community.php b/include/download-instructions/linux-ubuntu-cli-community.php new file mode 100644 index 0000000000..578010a8a1 --- /dev/null +++ b/include/download-instructions/linux-ubuntu-cli-community.php @@ -0,0 +1,10 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo apt update +sudo apt install -y software-properties-common +sudo add-apt-repository ppa:ondrej/php -y +sudo apt update +sudo apt install -y php<?= $version; ?> +</pre> diff --git a/include/download-instructions/linux-ubuntu-cli-default.php b/include/download-instructions/linux-ubuntu-cli-default.php new file mode 100644 index 0000000000..ce0b0e3513 --- /dev/null +++ b/include/download-instructions/linux-ubuntu-cli-default.php @@ -0,0 +1,7 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo apt update +sudo apt install -y php +</pre> diff --git a/include/download-instructions/linux-ubuntu-web-community.php b/include/download-instructions/linux-ubuntu-web-community.php new file mode 120000 index 0000000000..cbcc4a6ff3 --- /dev/null +++ b/include/download-instructions/linux-ubuntu-web-community.php @@ -0,0 +1 @@ +linux-ubuntu-cli-community.php \ No newline at end of file diff --git a/include/download-instructions/linux-ubuntu-web-default.php b/include/download-instructions/linux-ubuntu-web-default.php new file mode 120000 index 0000000000..c4a0004521 --- /dev/null +++ b/include/download-instructions/linux-ubuntu-web-default.php @@ -0,0 +1 @@ +linux-ubuntu-cli-default.php \ No newline at end of file diff --git a/include/download-instructions/osx-homebrew-php.php b/include/download-instructions/osx-homebrew-php.php new file mode 100644 index 0000000000..895264fa2e --- /dev/null +++ b/include/download-instructions/osx-homebrew-php.php @@ -0,0 +1,9 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +brew tap shivammathur/php +brew install php@<?= $version; ?> + +brew link --force --overwrite php@<?= $version; ?> +</pre> diff --git a/include/download-instructions/osx-homebrew.php b/include/download-instructions/osx-homebrew.php new file mode 100644 index 0000000000..84cbaa4a7f --- /dev/null +++ b/include/download-instructions/osx-homebrew.php @@ -0,0 +1,8 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +brew install php@<?= $version; ?> + +brew link --force --overwrite php@<?= $version; ?> +</pre> diff --git a/include/download-instructions/osx-macports.php b/include/download-instructions/osx-macports.php new file mode 100644 index 0000000000..847f8d8d20 --- /dev/null +++ b/include/download-instructions/osx-macports.php @@ -0,0 +1,6 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +sudo port install php<?= $versionNoDot; ?> +</pre> diff --git a/include/download-instructions/windows-chocolatey.php b/include/download-instructions/windows-chocolatey.php new file mode 100644 index 0000000000..b4dbf10256 --- /dev/null +++ b/include/download-instructions/windows-chocolatey.php @@ -0,0 +1,6 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +choco install php --version=<?= $version; ?> -y +</pre> diff --git a/include/download-instructions/windows-native.php b/include/download-instructions/windows-native.php new file mode 100644 index 0000000000..e1e30cd926 --- /dev/null +++ b/include/download-instructions/windows-native.php @@ -0,0 +1,6 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +powershell -c "irm https://php.net/downloads/install.ps1 <?= $version; ?> | iex" +</pre> diff --git a/include/download-instructions/windows-scoop.php b/include/download-instructions/windows-scoop.php new file mode 100644 index 0000000000..087ab091c5 --- /dev/null +++ b/include/download-instructions/windows-scoop.php @@ -0,0 +1,6 @@ +<p> +On the command line, run the following commands: +</p> +<pre class="shellCommands"> +scoop install php@<?= $version; ?> +</pre>