Created
November 6, 2024 07:04
-
-
Save timbogdanov/7df621b7bf3b8987c7c1a06488057789 to your computer and use it in GitHub Desktop.
PHP 8.2 bash install script
This file contains 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 package list | |
sudo apt-get update | |
# Install prerequisites | |
sudo apt-get install -y \ | |
software-properties-common \ | |
build-essential \ | |
autoconf \ | |
bison \ | |
re2c \ | |
libxml2-dev \ | |
libzip-dev \ | |
libpng-dev \ | |
libjpeg-dev \ | |
libonig-dev \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libpq-dev \ | |
zlib1g-dev \ | |
libprotobuf-dev \ | |
protobuf-compiler \ | |
imagemagick \ | |
libmagickwand-dev \ | |
supervisor \ | |
git \ | |
curl \ | |
zip \ | |
unzip \ | |
nano | |
# Add PHP repository | |
sudo add-apt-repository ppa:ondrej/php -y | |
sudo apt-get update | |
# Install PHP 8.2 and extensions | |
sudo apt-get install -y \ | |
php8.2-fpm \ | |
php8.2-cli \ | |
php8.2-zip \ | |
php8.2-gd \ | |
php8.2-pgsql \ | |
php8.2-xml \ | |
php8.2-curl \ | |
php8.2-exif \ | |
php8.2-soap \ | |
php8.2-bcmath \ | |
php8.2-sockets \ | |
php8.2-dev \ | |
php-pear | |
# Install Composer | |
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
# Install and enable Imagick extension | |
sudo pecl install imagick | |
sudo bash -c 'echo "extension=imagick.so" > /etc/php/8.2/mods-available/imagick.ini' | |
sudo phpenmod imagick | |
# Install and enable gRPC and Protobuf extensions | |
sudo pecl install grpc | |
sudo bash -c 'echo "extension=grpc.so" > /etc/php/8.2/mods-available/grpc.ini' | |
sudo phpenmod grpc | |
sudo pecl install protobuf | |
sudo bash -c 'echo "extension=protobuf.so" > /etc/php/8.2/mods-available/protobuf.ini' | |
sudo phpenmod protobuf | |
# Install gRPC PHP Plugin for Protobuf | |
sudo curl -L https://github.com/grpc/grpc/releases/download/v1.48.0/grpc_php_plugin -o /usr/local/bin/grpc_php_plugin | |
sudo chmod +x /usr/local/bin/grpc_php_plugin | |
# Restart PHP-FPM service | |
sudo systemctl restart php8.2-fpm | |
# Install Supervisor | |
sudo apt-get install -y supervisor | |
# Create Supervisor configuration directory | |
sudo mkdir -p /etc/supervisor/conf.d | |
# Copy Supervisor configuration (ensure you have the correct path to your supervisord.conf) | |
# sudo cp /path/to/your/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
# Reload Supervisor to apply new configuration | |
sudo supervisorctl reread | |
sudo supervisorctl update | |
echo "PHP 8.2 and required extensions have been installed successfully." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment