Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 8 - Install GPG Extension for PHP 5.6

Below is a script you can run to install the GPG extension for the PHP 5.6 CLI and Apache on Debian 8. It may work on other distributions and versions of PHP, but I have not tested that. The script assumes you already have Php 5.6 and Apache installed.

Related Posts

Script

#!/bin/bash
sudo apt-get install libgpgme11-dev php-pear php5-dev -y
sudo pecl install gnupg

# Update the php.ini files for Apache and the CLI
SEARCH=";   extension=msql.so"
REPLACE=";   extension=msql.so\nextension=gnupg.so"
FILEPATH="/etc/php5/cli/php.ini"
sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH

FILEPATH="/etc/php5/apache2/php.ini"
sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH

As always, you can use prog-exec for a one-command install

prog-exec "25/1" "e1a27a66f7d8eb1e2c2468475011c73dd453365a857609ff1c91254d686308c4"
Last updated: 26th February 2021
First published: 16th August 2018