Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a webserver running OpenBSD 4.7 and PHP 5.2.12 out of the ports tree. There is a small contact page that is supposed to send an email to a specific address. When I fill in the form using a web browser, it sends the AJAX request to the PHP page which claims it worked successfully but there is no email. The maillog is empty as well. I created a small php script that replicates this functionality and when I run it by hand using the "php -f" command, it sends an email without a problem. I think this has to do with being chrooted but I can't seem to get it to work. Furthermore, I can't seem to get PHP to log. I told it to log to /var/www/logs/php_errors.log and restarted but can't get it to send anything to the file. Does anyone have any tips for debugging these sort of things in OpenBSD?

share|improve this question
If it's chrooted, have you looked in the /[chroot]/var/www/logs/ folder? – Chris S Jan 4 '11 at 21:18

So this is how I fixed it:

First, I had to compile a program called mini_sendmail and place it in /var/www/usr/sbin (php.ini was pointing to /usr/sbin/sendmail -t -i).

Second, I had to make sure that /bin/sh was copied into /var/www/bin/sh and /etc/resolv.conf was copied into /var/www/etc/resolv.conf. I still didn't get logging to work but I was able to finally get the web page to send emails.

share|improve this answer
Note that I named the mini_sendmail binary as "sendmail" in the chrooted location. – MattC Jan 4 '11 at 22:25
Had you considered simply adjusting PHP to make a SMTP connect to a mail server instead of using sendmail? – Zoredache Jan 5 '11 at 2:13
I did consider that, but I wasn't the one that wrote the code so I'd rather not start cutting it up if I can avoid it. – MattC Jan 5 '11 at 5:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.