1

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?

MattC
  • 377
  • 1
  • 4
  • 11

1 Answers1

1

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.

MattC
  • 377
  • 1
  • 4
  • 11
  • Note that I named the mini_sendmail binary as "sendmail" in the chrooted location. – MattC Jan 04 '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 05 '11 at 02: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 05 '11 at 05:29