chmod 777chmod(string $filename , int $permissions ): bool Attempts to change the mode of the specified file to that given in permissions.Yes, it is dangerous to set chmod 777 permissions. You should only use chmod 755 for directories and chmod 644 for files. You should only