How to replace 1024-1054 bytes of a large file with a by php

I don"t want to use the file_get_contents function because the file is too large

Php
Mar.28,2021

$fp = fopen('a.txt', 'r+');
fseek($fp, 1024);
fwrite($fp, str_repeat('a', 30));
fclose($fp);

use the SplFileObject class extended by SPL to handle large files

$oFile = new SplFileObject($filename,'w');

$oFile->fseek(1024,SEEK_SET);

$oFile->fwrite(str_repeat('a',30));

$oFile = null;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a999-2c242.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a999-2c242.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?