With the design of PHPA 1.3, if the permissions on the PHPA shared memory
cache are misconfigured or left unset then
apache restarts can cause the server to stop
working. If you see PHPA error messages in the apache error log about
operations not being permitted, or permission denied, then that is definitely
what's wrong. This is easily fixed.
Correct Configuration
Note that manual setting of shm_user and shm_group is only
required before release 1.3.2 revision 2.
Correct configuration requires that the PHPA shm_user and shm_group settings
ini settings are set to the same user and group that apache is configured to
run as. These should be found in the apache httpd.conf file, e.g.
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group nogroup on these systems!
#
User nobody
Group nogroup
In this case the apache user and group are set to nobody and nogroup, and so
these are the
settings to use for shm_user and shm_group. NOTE Never put single
quotes (') around the names because PHP does not treat these as delimiters, but
as part of the name! Either have no quotes or use double quotes (").
After changing the settings, follow
the recovery procedure below to ensure that they will take effect.
Recovering from a server hang
To successfully restart apache after a hang, and recommended after correcting
an incorrect configuration, follow the steps below.
- Stop apache
- Use 'ps axg | grep httpd' to check that there are no apache processes
still running. If there are, use 'kill' to kill them and check again until
they have all gone
- Use 'phpa_cache_admin -D' to ensure that the PHPA shared memory cache
has been deleted
- Run 'ipcs' and look for any items with key 0x0c0deb00 or 202238720.
There should not be any, but if there are then 'ipcrm' can be used to remove
them
- Restart apache
- Run 'ipcs' again. Now there should be both a shared memory segment and
semaphores with key 0x0c0deb00. Check that the ownership is the same owner
as you set for shm_user
Apache should now be running happily, and restarts should present no further
problems.