troubleshooting Question

GnuPG PHP website - encryption will not work from PHP

Avatar of Daizzy-Mae
Daizzy-Mae asked on
11 Comments1 Solution419 ViewsLast Modified:
I am able to encrypt using PuTTY from the command line, but not from my web-page.

Here is my line of PHP code: system("/usr/bin/gpg --homedir /gnupg-files/.gnupg --encrypt -ao encryptedfile.txt -r 'Rhiannon <>' 789.txt");

When I use PuTTY I type this in:
[ /]$ gpg --homedir /gnupg-files/.gnupg --encrypt -a                      o encryptedfile.txt -r 789.txt

Initially I thought it was a permissions problem but I seem to be logged in to PuTTY as the same user as I am on the website:

Website user:
echo system("id");

gives me
uid=186655( gid=100(users) groups=65533(nobody),65534(nogroup) uid=186655( gid=100(users) groups=65533(nobody),65534(nogroup)

PuTTY user:
[ /]$ id -u

[ /]$ whoami


We had GnuPG working nicely on the old server, then our hosting company got bought out by and we got moved to their servers... and now it will not work!

It simply will not create an encrypted file using GnuPG.

I am on Bash shell in Linux with fairly restricted permissions (eg. I am not allowed to use the chown command).

Do you think this could be a problem with my PHP in the line above?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros