Skip to content

Instantly share code, notes, and snippets.

@chris-huffman
Last active January 26, 2024 18:11
Show Gist options
  • Save chris-huffman/68b0e62d75409d519aa66008180a816e to your computer and use it in GitHub Desktop.
Save chris-huffman/68b0e62d75409d519aa66008180a816e to your computer and use it in GitHub Desktop.
Install source guardian for PHP 7.2
#Run the following commands to install SourceGuardian Loader
#The example below is for PHP 7.2. Please use the version that applies to your situation.
sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
curl https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz --output loaders.linux-x86_64.tar.gz
tar xzf loaders.linux-x86_64.tar.gz
cp ixed.7.2.lin /usr/lib64/php/modules/
cd /etc/php.d/
#Content for sourceguardian.ini file:
echo "[sourceguardian]" > sourceguardian.ini
echo "zend_extension=/usr/lib64/php/modules/ixed.7.2.lin" >> sourceguardian.ini
systemctl restart php-fpm.service
#### Example for PHP 7.3 ####
sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
curl https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz --output loaders.linux-x86_64.tar.gz
tar xzf loaders.linux-x86_64.tar.gz
cp ixed.7.3.lin /usr/lib64/php/modules/
cd /etc/php.d/
#Content for sourceguardian.ini file:
echo "[sourceguardian]" > sourceguardian.ini
echo "zend_extension=/usr/lib64/php/modules/ixed.7.3.lin" >> sourceguardian.ini
systemctl restart php-fpm.service
@chris-huffman
Copy link
Author

Thanks! I've updated the snippet to include that.

@TyagiSoftTech
Copy link

wget http://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz
URL transformed to HTTPS due to an HSTS policy
--2021-05-11 15:01:01-- https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz
Resolving www.sourceguardian.com (www.sourceguardian.com)... 88.198.213.101
Connecting to www.sourceguardian.com (www.sourceguardian.com)|88.198.213.101|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2021-05-11 15:01:03 ERROR 403: Forbidden.
How to solve these error?

@chris-huffman
Copy link
Author

Looks like SourceGuardian updated their site to require the user to accept their terms and conditions before downloading. I updated the script to use curl and that seems to work now.

@joshfedo
Copy link

joshfedo commented Dec 7, 2021

#### Example for PHP 7.4 ####
sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
curl https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz --output loaders.linux-x86_64.tar.gz
tar xzf loaders.linux-x86_64.tar.gz
cp ixed.7.4.lin /usr/lib64/php/modules/

cd /etc/php.d/

#Content for sourceguardian.ini file:
echo "[sourceguardian]" > sourceguardian.ini
echo "zend_extension=/usr/lib64/php/modules/ixed.7.4.lin" >> sourceguardian.ini

systemctl restart php-fpm.service

@Manikantasripadi
Copy link

@TyagiSoftTech
wget http://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"

@kraken-chris
Copy link

kraken-chris commented Jan 26, 2024

Example for PHP 8.1

This example assumes the current version of Warden (0.14.2).

Ideally the latest version is built into Warden as restarting the container will wipe out these changes.

sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
curl https://www.sourceguardian.com/loaders/download/loaders.linux-aarch64.tar.gz --output loaders.linux-aarch64.tar.gz
tar xzf loaders.linux-aarch64.tar.gz 
cp ixed.8.1.lin /usr/lib64/php/modules/
cd /etc/php.d/
cat 15-sourceguardian.ini 
# Contents should only be only this line:
echo "extension=/usr/lib64/php/modules/ixed.8.1.lin" >> 15-sourceguardian.ini 


# Restart php service without restarting the container
kill -USR2 1

# Check Source Guardian version
php -ini | grep "Source"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment