Last active
April 12, 2025 04:57
-
-
Save osbre/1a85a722d7e8772025f4ead89881809b to your computer and use it in GitHub Desktop.
A script to install PHP 8.4 and Composer on Debian/Ubuntu servers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update and install necessary packages | |
sudo apt update | |
sudo apt install -y lsb-release apt-transport-https ca-certificates curl | |
# Add Ondřej Surý's PHP repository | |
curl -fsSL https://packages.sury.org/php/README.txt | sudo bash - | |
# Install PHP 8.4 and required extensions for Laravel | |
sudo apt install -y unzip php8.4 php8.4-cli php8.4-mbstring php8.4-xml php8.4-mysql php8.4-curl php8.4-bcmath php8.4-zip php8.4-soap php8.4-intl php8.4-common php8.4-opcache php8.4-pgsql php8.4-sqlite3 | |
# Set PHP 8.4 as default | |
sudo update-alternatives --set php /usr/bin/php8.4 | |
sudo update-alternatives --set phpize /usr/bin/phpize8.4 | |
sudo update-alternatives --set php-config /usr/bin/php-config8.4 | |
# Install Composer globally | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
# Verify PHP and Composer installation | |
php -v | |
php -m | |
composer --version | |
echo "PHP 8.4 and Composer have been installed successfully!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment