My code: PHP: if (!file_exists(dirname($this->getDataFolder(), 2)) . "/start.sh") { @copy($this->getResource("start.sh"), dirname($this->getDataFolder() . "/start.sh", 2)); } Error log: Code: TypeError: "copy() expects parameter 1 to be a valid path, resource given" (EXCEPTION) in "plugins/LabRestarter/src/Endermanbugzjfc/LabRestarter/LabRestarter" at line 74
getResource returns a file handle. You should use the stream family of functions (e.g. fread, fseek, stream_get_contents, etc.), not the filesystem family of functions.