Problems, need help? Have a tip or advice? Post it here.
14 posts Page 1 of 2
hi, I observed I'm getting a fatal error in server

[09-Nov-2012 12:51:03] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 84 bytes) in /public_html/domain.com/couch/p7h.php on line 6

Why?? wat is the problem?
Hi Robert,

Seems like PHP is running out of the memory (64MB as appears from from the error) allocated to it.
While Couch itself works well even with 8MB of memory, the ulilization really depends on how you have structured your site.
Try increasing the memory limit by editing your php.ini
memory_limit = 128M ;

If php.ini is not accessible, contact your hosting provider.

Hope this helps.
I contacted hosting providers they said as sharing host it was only allocated 64m of memory only. And they said it won't trouble in running site but asked to optimize code.(which i realy dont know how to do :o) and when I check'd in webmaster tools i found sitemap is giving error. when i check'd sitemap it's showing this error..
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 76 bytes) in /home/cosmesns/public_html/domain.com/couch/p7h.php on line 6


Is it because of sitemap? M confused..why sitemap is not displaying?
Can you please PM me your site's FTP + Couch super-admin creds?
Thanks.
Thanks for the creds.

I had a look. Your sitemap was trying to display nearly 300 pages (which is ok for output meant to be read by Google. For humans, we always use pagination after 10-20 pages).

Anyways, doing so made PHP run out of memory and ergo the error.
For a fix, I have added a skip_custom_fields='1' parameter to the cms:pages loop.
This makes Couch skip trying to load the custom fields, which is ok in our case as the sitemap generation only requires the system fields of a page (its title, date etc.). This saves memory for us.

The rectified markup is this (I have already made the changes to your site's template so you don't have to apply this):
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
           
   <cms:templates order='asc' >
      <cms:pages masterpage=k_template_name show_future_entries='1' skip_custom_fields='1'>
         <url>
           <loc><cms:show k_page_link /></loc>
           <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
           <changefreq>daily</changefreq>
         </url>
      </cms:pages>
   </cms:templates>

</urlset>
<?php COUCH::invoke(); ?>

Things are working for now but sometime in the future, as the number of your pages keep growing, it is inevitable that you'll hit the memory mark again (maybe at about 3000 pages).
It could also be that you first hit the maximum script execution time permitted first while listing all these pages.

http://www.html-sitemap.com/html-sitema ... avigation/ suggests (and I concur) that
If your website is very large and you start to have above 100-200 links on a sitemap page, you should consider splitting your sitemap across multiple pages. Even if your users can navigate the HTML sitemap, search engines such as Google and Yahoo may start ignore links if you have thousands on a single page.

For very large number of pages, we can use 'Sitemap index file' method suggested by Google itself - http://support.google.com/webmasters/bi ... 35655&rd=1

Hope this helps.
KK.. thank you very much for your explanation and your help.. :)
I will try to implement everything you have suggested
HI KK.. I have created separate sitemaps and created index file for sitemaps but the problem is the urls in sitemap are repeating nearly 29times ..I checked everything but not knowing where the problem existing from..
Could you please post the code that you are using to create the sitemaps?
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
           
   <cms:templates order='asc' >
      <cms:pages masterpage='page.php' show_future_entries='1' skip_custom_fields='1'>
         <url>
           <loc><cms:show k_page_link /></loc>
           <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
           <changefreq>daily</changefreq>
         </url>
      </cms:pages>
   </cms:templates>

</urlset>
<?php COUCH::invoke(); ?>
Since now you are using explicit value for the 'masterpage' parameter in cms:pages tag, you don't require to wrap the cms:pages tag within the cms:templates tag.

It was originally done so that cms:templates tag loops through all the available templates on your system calling the nested cms:pages tag with the name of each template found (the 'k_template_name' variable used with the 'masterpage' parameter).
In your case it is still calling the cms:pages loop to execute as many times as there are templates available but since the 'masterpage' parameter is now a fixed value, effectively the pages of the same template are listed every time (29 times as you mentioned).

Your revised code should look like this -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
           
      <cms:pages masterpage='page.php' show_future_entries='1' skip_custom_fields='1'>
         <url>
           <loc><cms:show k_page_link /></loc>
           <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
           <changefreq>daily</changefreq>
         </url>
      </cms:pages>

</urlset>
<?php COUCH::invoke(); ?>

Hope this helps.
14 posts Page 1 of 2

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests

cron