Merge pull request #87 from florentdestremau/feature/add-php

Add php install/uninstall script
This commit is contained in:
David Heinemeier Hansson
2024-06-13 21:05:27 +02:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

18
install/php.sh Normal file
View File

@@ -0,0 +1,18 @@
# install php with basic extensions
sudo add-apt-repository -y ppa:ondrej/php
sudo apt -y install php8.3 php8.3-{curl,apcu,intl,mbstring,opcache,pgsql,mysql,sqlite3,redis,xml,zip}
# install composer, the PHP package manager
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet && sudo mv composer.phar /usr/local/bin/composer
rm composer-setup.php

4
uninstall/php.sh Normal file
View File

@@ -0,0 +1,4 @@
sudo apt -y purge "php8.3*"
sudo add-apt-repository -y --remove ppa:ondrej/php
sudo rm /usr/local/bin/composer