Mysql – chrooted Apache+MsSQL on openBSD; Could not determine the server’s fully qualified domain name

apachechrootdatabase connectionMySQLopenbsd

php generates GIFs on the web server using a databases on a second server.
The page shows 20 GIFs, so there is some load for a short time (multiple connections)


Some GIFs are loaded but some are not, in /var/www/logs/error_log

[Mon Feb 23 10:05:56 2009] [error] PHP Warning:  mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 in /htdocs/.../myImage.php on line 4
[Mon Feb 23 10:05:56 2009] [error] PHP Fatal error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 in /htdocs/.../myImage.php on line 4

in /var/www/logs/error_log on the MySQL server I found:

[alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Rebooting the MySQL server "resolves" the problem … for a few days.

The 2 servers are virtual machines running OpenBSD, chroot'ed Apache and MySQL + phpMyAdmin.
unfortunately in diferent versions (OpenBSD 4.2(web) and 3.9(mysql))

my knowledge in /var/www/conf/httpd.conf and my.cnf(didn't found it) is very limited.
Any ideas ?

Best Answer

Have you tried putting resolv.conf inside chroot? Such as:

mkdir -p /var/www/etc/ && cp -p /etc/resolv.conf /var/www/etc/

You may also wish to do the same for /etc/localtime if you find your web server time is off from your time zone.

Note:

  • do not use a sym link because it won't work through chroot
  • do not use a hard link because modifying file in chroot would modify file in /etc!