Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
I got an errror when access my sitemap.php

Here's my sitemap code:
Code: Select all
<?php require_once( 'admin/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>
         <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(); ?>


How this happen? thanks in advance.
Hi,

I tested and your code works just fine for me. So nothing wrong with the code.

Are you sure you have renamed your 'couch' folder to 'admin' (as is suggested by the first PHP statement in your template)?
That could be a possible reason for the error.

If that is not the case, try looking at your web server's error log. It should provide the exact reason.

Hope it helps.
KK wrote: Hi,

I tested and your code works just fine for me. So nothing wrong with the code.

Are you sure you have renamed your 'couch' folder to 'admin' (as is suggested by the first PHP statement in your template)?
That could be a possible reason for the error.

If that is not the case, try looking at your web server's error log. It should provide the exact reason.

Hope it helps.


Ok then KK.

Thanks for the reply, i will check the problem at the error log.

Thanks KK.
Still not work KK, this is on the error log.
Code: Select all
[23-Mar-2017 15:48:33 UTC] PHP Warning:  require_once(couch/cms.php): failed to open stream: No such file or directory in /home/desainco/public_html/sitemap.php on line 1

But, im preety sure my root is admin/sitemap.php.

Thanks
Please get me FTP+Couch access to your site and I'll take a look at the issue.
Thanks.
KK wrote: Please get me FTP+Couch access to your site and I'll take a look at the issue.
Thanks.


I have send my site creds. Thanks kk for the help.
Thanks. I had a look and found the 'error_log' file repeatedly reporting the following -
[29-Mar-2017 17:24:34 America/New_York] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 36466 bytes) in /home/desainco/public_html/admin/tags.php on line 2659

As you can see, the problem was the scant 32MB of memory available for your script to run.

The obvious remedy in such case would be to increase the memory limit. As discussed in several threads, we should first try by using using PHP's -
Code: Select all
ini_set( 'memory_limit', '-1' );

In case that does not work on your host, we can then move to editing the php.ini file itself (on hosts where php.ini is not directly available for editing, one has to ask the hosting provider to do this).

Anyway, I tested and, thankfully, the first method worked for your site. I placed the directive right on the first line of PHP we have on all Couch templates, so now your sitemap template begins this way -
Code: Select all
<?php ini_set('memory_limit', '-1'); require_once('admin/cms.php'); ?>

As an optimization, I also made a slight change to the <cms:pages> loop to make it skip fetching custom-fields (this should save some amount of memory). That statement now appears as follows -
Code: Select all
<cms:pages masterpage=k_template_name skip_custom_fields='1'>

With those two changes, your template seems to be working fine. Please check and confirm.

For archival purposes, here is the complete code of the modified template
Code: Select all
<?php ini_set('memory_limit', '-1'); require_once('admin/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 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(); ?>
Great, i have no idea to place the memory limit there.
I have found the error before but when i look at the tags.php its nothing there.
But im glad my problem solved now.

Thanks a lot KK.
You are welcome :)
9 posts Page 1 of 1
cron