I am attempting to create a csv file to update my inventory in Magento. My code is as follows:
I have exported 600MB+ sized csv files from PHP and MySQL in a similar way that you are with no issues. Sounds like a problem with your environment settings - not with the code or a limitation of the technologies.