diff --git a/hphp/runtime/ext/ext_network.cpp b/hphp/runtime/ext/ext_network.cpp index 3d1754a861d6c..415a36c215508 100644 --- a/hphp/runtime/ext/ext_network.cpp +++ b/hphp/runtime/ext/ext_network.cpp @@ -35,6 +35,14 @@ #include #endif +// HOST_NAME_MAX is recommended by POSIX, but not required. +// FreeBSD and OSX (as of 10.9) are known to not define it. +// 255 is generally the safe value to assume and upstream +// PHP does this as well. +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + #define MAXPACKET 8192 /* max packet size used internally by BIND */ #define DNS_T_A 1 #define DNS_T_NS 2