note 55325 deleted from function.mail by sean
| From: | sean@php.net | Date: | Sat, 30 Jul 2005 17:55:01 +0000 |
| Subject: | note 55325 deleted from function.mail by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92772@lists.php.net to get a copy of this message | ||
Note Submitter: tf8 at list dot ru
----
There is a problem with mail() in apache chroot
I have spend 2 days in ktrace'ing and kdump'ing to figure out that the mail() function
requires those things to work:
number of .so libraries to work. I dont remember all of them but u can trace them out by running for
example ktrace -f /tmp/ktrace php -f tf8.php and then kdump -f /tmp/ktrace | grep .so or by strings
sh; strings php; strings sendmail;
and mail() requires also ( for apache 1.3.33 and basicaly installed sendmail on freebsd):
1. /bin/sh
2. /usr/sbin/sendmail
3. existance and permission to read/write/execute by the user under which your apache is running in
chroot to the directory /var/spool/mqueue
commands: (hopefully i have not forgot anything):
mkdir -p /usr/chroot/dev
mkdir -p /usr/chroot/etc
mkdir -p /usr/chroot/var/run
mkdir -p /usr/chroot/lib
mkdir -p /usr/chroot/usr/libexec
mkdir -p /usr/chroot/libexec
mkdir -p /usr/chroot/usr/local/lib/mysql
mknod /usr/chroot/dev/null c 2 2
chown root:sys /usr/chroot/dev/null
chmod 666 /usr/chroot/dev/null
cp /lib/libcrypt.so.2 /usr/chroot/lib/
cp /usr/local/lib/mysql/libmysqlclient.so.14 /usr/chroot/usr/local/lib/mysql/
cp /usr/local/lib/libiconv.so.3 /usr/chroot/usr/local/lib/
cp /usr/local/lib/libfreetype.so.9 /usr/chroot/usr/local/lib/
cp /usr/local/lib/libpng.so.5 /usr/chroot/usr/local/lib/
cp /lib/libz.so.2 /usr/chroot/lib/
cp /usr/local/lib/libjpeg.so.9 /usr/chroot/usr/local/lib/
cp /lib/libm.so.3 /usr/chroot/lib/
cp /usr/local/lib/libxml2.so.5 /usr/chroot/usr/local/lib/
cp /lib/libc.so.5 /usr/chroot/lib/
cp /usr/libexec/ld-elf.so.1 /usr/chroot/usr/libexec/
cp /libexec/ld-elf.so.1 /usr/chroot/libexec/
cp /var/run/ld-elf.so.hints /usr/chroot/var/run/
mkdir /usr/chroot/sbin/
mkdir /usr/crhoot/usr/libexec/sendmail
cp /usr/sbin/sendmail /usr/chroot/sbin/sendmail
cp /usr/libexec/sendmail/sendmail /usr/chroot/sbin/sendmail
cp /lib/libutil.so.4 /usr/chroot/lib/
mkdir /usr/sites/www/usr/lib/
cp /usr/lib/libwrap.so.3 /usr/chroot/usr/lib/
cp /usr/lib/libssl.so.3 /usr/chroot/usr/lib/
cp /lib/libcrypto.so.3 /usr/chroot/lib/
mkdir -p /usr/chroot/etc/mail
mkdir -p /var/spool/mqueue/
chmod 777 /var/spool/mqueue/
cp /etc/mail/sendmail.cf /usr/chroot/mail/sendmail.cf
mkdir -p /bin/
cp /bin/sh /usr/chroot/bin/sh
cp /lib/libedit.so.4 /usr/chroot/lib/
cp /lib/libncurses.so.5 /usr/chroot/lib/