SourceGuardian is a widely used software that lets you encrypt and secure your PHP scripts. In this way, your source code is secure and no one can view or compile it, you can lock and unlock your code on the basis of strict parameters like server IP, server MAC address or Domain name, in this way, your code is unlocked on authentic place only. Source Guardian PHP extension is not enabled by default, if you have LAMP setup running on your system, you need to install and configure it separately. That’s what we will be focusing in this article, how to install and configure Source Guardian PHP extension on Ubuntu 15.04.
Installing SourceGuardian on Ubuntu
We are running PHP 5.6 and Apache 2 on our test system. Lets see how we can install and configure this extension there.
First of all, go to /usr/src directory by running the following command:
Here create a new directory named “loader” by running the following command.
Now go into this newly created directory.
And download Source Guardian tar file here.
For 32bit system:
For 64bit system:
As soon as the file has been download, extract it by running the following command:
That’s all, Now we need to copy the loader configuration file to PHP extenstion directory. Please note that if your PHP version is different, then you might have different folder/file name, run command accordingly.
Create a file for sourceguardian inside PHP5 mod’s directory i.e. /etc/php5/mods-available/, run following command to create file.
It will create an empty file in GEdit text editor, paste following content in this empty file. [Change your path or file names in case you are using different version of PHP]
Save the file and return back to the terminal windows. Run following command to enable this extension.
We are almost there, restart apache web server by running the following command:
Congratulations, SourceGuardian has been installed and enabled for your PHP now
In order to verify it, we need to see the output of phpinfo() function. Go to /var/www/html directory by running the following command.
Create an empty file here, named phpinfo.php by running the following command.
And paste following code in this file.
Save the file, launch your web browser and load http://localhost/phpinfo.php . It should load a page as shown in following screenshot, From here you should be able to confirm that Source Guardian is configured successfully (shown encircled in screenshot).
Enjoy securing and encrypting your PHP code.
Source Guardian is one of those few PHP extensions which focus on security and encryption. Not all hosting providers have this installed at the moment, but its certainly an option to consider when choosing your hosting provider or hosting setup. We hope you enjoyed the article, do let us know in comments