1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Re-do logic according to Shivam's instructions, and add instructions to repo

This commit is contained in:
Derick Rethans
2025-07-21 16:19:18 +01:00
parent e495c17b9e
commit 2e5b14f05e
24 changed files with 214 additions and 121 deletions

View File

@@ -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 => ''
};
$versionDir = match($options['version']) {
'php84' => '8.4',
'php83' => '8.3',
'php82' => '8.2',
'php81' => '8.1',
default => '8.4'
};
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
&lt;FilesMatch \.php$>
SetHandler application/x-httpd-php
&lt;/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 ($options['version'] === 'default') {
$options['version'] = $latestPhpVersion;
}
}
if (in_array($options['usage'], ['fw-drupal', 'fw-laravel', 'fw-symfony', 'fw-wordpress'])) {
$file = "{$options['usage']}";
$options['os'] = null;
}
$multiversion = false;
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 {
?>
<p>
There are no instructions yet. Try using the generic installation from source.
</p>
<?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:
</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;
return false;
}
?>
<p>
There are no instructions yet.
</p>
<?php var_dump($options); ?>

View File

@@ -56,40 +56,43 @@ $os = [
'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 @@ if (!array_key_exists('osvariant', $options) || !array_key_exists($options['osva
<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 @@ to verify the tags:
</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")

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" &gt; /etc/apt/sources.list.d/php.list'
sudo apt-get update
sudo apt-get install -y php<?= $version; ?>
</pre>

View File

@@ -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>

View File

@@ -0,0 +1 @@
linux-debian-cli-community.php

View File

@@ -0,0 +1 @@
linux-debian-cli-default.php

View File

@@ -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>

View File

@@ -0,0 +1,6 @@
<p>
On the command line, run the following commands:
</p>
<pre class="shellCommands">
sudo dnf install -y php
</pre>

View File

@@ -0,0 +1 @@
linux-fedora-cli-community.php

View File

@@ -0,0 +1 @@
linux-fedora-cli-default.php

View File

@@ -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>

View File

@@ -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>

View File

@@ -0,0 +1 @@
linux-ubuntu-cli-community.php

View File

@@ -0,0 +1 @@
linux-ubuntu-cli-default.php

View File

@@ -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>

View File

@@ -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>

View File

@@ -0,0 +1,6 @@
<p>
On the command line, run the following commands:
</p>
<pre class="shellCommands">
sudo port install php<?= $versionNoDot; ?>
</pre>

View File

@@ -0,0 +1,6 @@
<p>
On the command line, run the following commands:
</p>
<pre class="shellCommands">
choco install php --version=<?= $version; ?> -y
</pre>

View File

@@ -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>

View File

@@ -0,0 +1,6 @@
<p>
On the command line, run the following commands:
</p>
<pre class="shellCommands">
scoop install php@<?= $version; ?>
</pre>