Hope someone can help with this.
I have multiple tables with millions items and i would like to create a sitemap with these data.
I have been advised to use array_chunk($dataArray, 50000);
then foreach( $dataArray ad $data){
do ….
}
The issue i have is an array with a million items might cause some memory problems. I am also looking to update my sitemap everyday using a cronjob. Most hosts have a limit on the time a cronjob can run for. With this in mind, I would like to know the following.
1) Is this an efficient method of managing sitemaps?
2) Is there a more efficient way of creating/updating large data sitemaps frequently?
Google sitemaps have a maximum size of 10MBs or 50k items, which is why you are being advised to split yours out.
Instead of using
array_chunk, why not get 50,000 items at a time from MySQL? This would avoid the memory limit.Time limits on cron jobs can often be overwritten by using
[set_time_limit][1]– but in my opinion if you have a million pages and you’re still on a host that imposes rigid limits, you might think about moving to a more serious offering.Are you aware that, to have a million links sitemapped, you need 20 sitemaps (50k each) and a sitemap index?
http://en.wikipedia.org/wiki/Sitemap_index