If you're planning to use ftok() to generate an IPC identifier to share with other applications, note that PHP uses the ASCII value of the proj parameter to generate the key, not the proj (aka id) parameter itself.
The result of this is that if you're using "1" as the id on the PHP side, you'll need to use 49 elsewhere.
This may not be the case under all OS's, but certainly is for FreeBSD which requires the id parameter passed to ftok to be an int.
Also of note, ipcs and ipcrm are extremely useful for debugging SysV queues etc.
References:
http://www.freebsd.org/cgi/man.cgi?query=ftok
http://www.asciitable.com