diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 81dac9ecde..35fc0bb58e 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -105,6 +105,7 @@ class install_install extends module
 				$this->add_language($mode, $sub);
 				$this->add_bots($mode, $sub);
 				$this->email_admin($mode, $sub);
+				$this->disable_avatars_if_unwritable();
 
 				// Remove the lock file
 				@unlink($phpbb_root_path . 'cache/install_lock');
@@ -1941,6 +1942,21 @@ class install_install extends module
 		));
 	}
 
+	/**
+	* Check if the avatar directory is writable and disable avatars
+	* if it isn't writable.
+	*/
+	function disable_avatars_if_unwritable()
+	{
+		global $phpbb_root_path;
+
+		if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/'))
+		{
+			set_config('allow_avatar', 0);
+			set_config('allow_avatar_upload', 0);
+		}
+	}
+
 	/**
 	* Generate a list of available mail server authentication methods
 	*/