/** * 检查log目录是否可写 * @return bool */ public static function checkWriteable() { $ok = true; if (!is_dir(WORKERMAN_LOG_DIR)) { // 检查log目录是否可读 umask(0); if (@mkdir(WORKERMAN_LOG_DIR, 0777) === false) { $ok = false; } @chmod(WORKERMAN_LOG_DIR, 0777); } if (!is_readable(WORKERMAN_LOG_DIR) || !is_writeable(WORKERMAN_LOG_DIR)) { $ok = false; } if (!$ok) { $pad_length = 26; Master::notice(WORKERMAN_LOG_DIR . " Need to have read and write permissions\tWorkerman start fail"); exit("------------------------LOG------------------------\n" . str_pad(WORKERMAN_LOG_DIR, $pad_length) . "[31;40m [NOT READABLE/WRITEABLE] [0m\n\n[31;40mDirectory " . WORKERMAN_LOG_DIR . " Need to have read and write permissions[0m\n\n[31;40mWorkerman start fail[0m\n\n"); } }