Specifications
Log in to your account on the Web server and change the permissions on the file so that other
users will be able to read it. Type
chmod 644 filename
You will need to create a keyring so that the user who your PHP scripts get executed as can
use GPG. Which user this is depends on how your server is setup. It is often the user
‘nobody’, but could be something else.
Change to being the Web server user. You will need to have root access to the server to do this.
On many systems, the Web server runs as nobody. The following examples assume this. (You
can change it to the appropriate user on your system.) If this is the case on your system, type
su root
su nobody
Create a directory for nobody to store their key ring and other GPG configuration information
in. This will need to be in nobody’s home directory.
The home directory for each user is specified in /etc/passwd. On many Linux systems,
nobody’s home directory defaults to /, which nobody will not have permission to write to. On
many BSD systems, nobody’s home directory defaults to /nonexistent, which, as it doesn’t
exist, cannot be written to. On our system, nobody has been assigned the home directory /tmp.
You will need to make sure your Web server user has a home directory that they can write to.
Type
cd ~
mkdir .gnupg
The user nobody will need a signing key of their own. To create this, run this command again:
gpg --gen-key
As your nobody user probably receives very little personal email, you can create a signing only
key for them. This key’s only purpose is to allow us to trust the public key we extracted earlier.
To import the pubic key we exported earlier, use the following:
gpg --import filename
To tell GPG that we want to trust this key, we need to edit the key’s properties using
gpg --edit-key ‘Luke Welling <luke@tangledweb.com.au>’
On this line, the text in quotes is the name of the key. Obviously, the name of your key will not
be ‘Luke Welling <luke@tangledweb.com.au>’, but a combination of the name, comment,
and email address you provided when generating it.
Implementing Secure Transactions with PHP and MySQL
C
HAPTER 15
15
I
MPLEMENTING
S
ECURE
TRANSACTIONS
341
19 7842 CH15 3/6/01 3:40 PM Page 341










