Since this is your custom logic, it’s your job to diagnose any problems in it – only that will show who is at fault. Since this doesn’t use any Travis stock logic, it’s highly unlikely that Travis is at fault here.
I don’t remember any of my other PHP version builds to fail with this error. So, either it’s specific to this environment, or it is specific to the fact it is the first build in a row.