Skip to content

Commit

Permalink
Merge pull request #87 from florentdestremau/feature/add-php
Browse files Browse the repository at this point in the history
Add php install/uninstall script
  • Loading branch information
dhh committed Jun 13, 2024
2 parents 2b7f4fc + 4bffcbe commit 47e9b71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions install/php.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions uninstall/php.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 47e9b71

Please sign in to comment.