Forum

Thread tagged as: Problem, Error, Blog

Blog and categories update.

Ive come unstuck after following the instructions for updating the blog app and categories.

Blog posts are appearing fine and categories are working ok in the admin.

I have a list of blog post categories in the right hand column. 2 problems:

1) at the top of my site I have this error:

Warning: include(/home/oseaisla/public_html/perch/addons/apps/perch_categories/runtime.php): failed to open stream: No such file or directory in /home/oseaisla/public_html/perch/config/apps.php on line 6

Warning: include(): Failed opening '/home/oseaisla/public_html/perch/addons/apps/perch_categories/runtime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/oseaisla/public_html/perch/config/apps.php on line 6

2) When I click on a category in the right hand column, it links to a page that gives this error:

Fatal error: Class 'PerchCategories_Categories' not found in /home/oseaisla/public_html/perch/addons/apps/perch_blog/runtime.php on line 503

Category links in right hand column, in index.php and post.php:

<div class="blog-themes">
    <!--  Category listing -->
    <?php perch_blog_categories(array(
        'template' => 'category_link.html'
        )); ?>
</div>

Markup in 'category_link.html

<perch:before>
<h3>Publication:</h3>
<ul>
</perch:before>
    <li><a href="archive.php?cat=<perch:category id="catSlug" />"><perch:category id="catTitle" /> (<perch:category id="count.blog.post" />)</a></li>
<perch:after></ul></perch:after>

Diagnostics:

Perch is up to date PHP 5.5.10 is up to date MySQL 5.5.34 is up to date Image processing available SUMMARY INFORMATION

Perch: 2.8.4, PHP: 5.5.10, MySQL: 5.5.34, with PDO Server OS: Darwin, apache2handler Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_blog (4.6), perch_forms (1.7), perch_mailchimp (2.0.1), perch_backup (1.2) App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_mailchimp/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_categories/runtime.php'); ?> PERCH_LOGINPATH: /perch PERCH_PATH: /Applications/MAMP/htdocs/05creative/osea/site/perch PERCH_CORE: /Applications/MAMP/htdocs/05creative/osea/site/perch/core PERCH_RESFILEPATH: /Applications/MAMP/htdocs/05creative/osea/site/perch/resources Image manipulation: GD (image sharpening disabled, #66714) PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M Resource folder writeable: Yes HTTP_HOST: localhost DOCUMENT_ROOT: /Applications/MAMP/htdocs/05creative/osea/site REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Chris James

Chris James 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Your path to the Categories app is incorrect. It's in Perch Core, the same as content.

I'd suggest moving to the new format for apps.php as it saves you needing to know the paths.

Both methods are detailed in the documentation: https://docs.grabaperch.com/docs/installing-perch/installing-apps/

OK there is some progress but I'm still getting something wrong. Ive changed the format to this, as you suggested:

<?php
    $apps_list = array(
        'content',
        'perch_forms',
        'mailchimp',
        'categories',
        'perch_blog',
    );
?>

And it's linking correctly to the archive page, which has the 'Archive of:' heading, but underneath that its blank, not producing any archive posts

if (perch_get('cat')) {
  echo '<h1>Archive of: '.perch_blog_category(perch_get('cat'), true).'</h1>';

    perch_blog_custom(array(
    'category'   => perch_get('cat'),
    'template'   => $template,
    'count'      => $posts_per_page,
    'sort'       => $sort_by,
    'sort-order' => $sort_order,
 ));

$posts_displayed = true;
}

What's wrong now? Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn debug on, what does it output?

I get this is the admin

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=2 AND u.userHash='f70f78ef05b4530b35817338e75dd4dc' LIMIT 1
UPDATE perch2_users SET userHash='91cb4453705f5b863e002fd8c1e21c23' WHERE userID=2
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=2 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * FROM perch2_category_sets WHERE setID=6 LIMIT 1
SELECT c.*, (SELECT COUNT(*) FROM perch2_categories WHERE catParentID=c.catID) AS subcats FROM perch2_categories c WHERE setID=6 ORDER BY catTreePosition ASC
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you get on the page?

This is the error on the empty archive page

Debug Message
SELECT * FROM perch2_pages WHERE pagePath='/blog/archive.php' LIMIT 1
Fetching from cache: perch_blog_category623edc53a43829dd94dfe2a6b192eb4f
Cache file not found: perch_blog_category623edc53a43829dd94dfe2a6b192eb4f
SELECT * FROM perch2_categories WHERE catPath='blog/sunday-times/' LIMIT 1
SELECT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/sunday-times/%' OR idx.indexKey='_category' AND idx.indexValue='blog/sunday-times/')
SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' AND idx.itemID IN (NULL) WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2015-03-27 08:00:00' ) GROUP BY itemID ORDER BY sortval DESC LIMIT 0, 10
SELECT FOUND_ROWS() AS `count`
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/blog/post_in_list.html
Fetching from cache: perch_blog_date_archive_monthsf2e7d49784704a5b24102a78c349d57c
SELECT year(postDateTime) as year, COUNT(*) AS year_qty FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2015-03-27 08:00:00' GROUP BY year ORDER BY year DESC
Using template: /templates/blog/months_month_link.html
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2015' AND p.postStatus='Published' AND p.postDateTime<='2015-03-27 08:00:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2014' AND p.postStatus='Published' AND p.postDateTime<='2015-03-27 08:00:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2013' AND p.postStatus='Published' AND p.postDateTime<='2015-03-27 08:00:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2012' AND p.postStatus='Published' AND p.postDateTime<='2015-03-27 08:00:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2011' AND p.postStatus='Published' AND p.postDateTime<='2015-03-27 08:00:00' GROUP BY year, month ORDER BY month DESC
Using template: /templates/blog/months_year_link.html
Caching: perch_blog_date_archive_monthsf2e7d49784704a5b24102a78c349d57c
Fetching from cache: perch_blog_categories589c7a634eb12f2ec225cfedc7dc78ae
Using template: /templates/mailchimp/subscribe.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

And you definitely have posts in the category blog/sunday-times/ ?

Hi Im picking up on this thread again. Someone else on here very kindly tried to help with it but ran into a dead end, so we still have no solution.

The situation is slightly improved in that I don't have the php error message appearing on the screen. I have shown debug reports below.

Basically, the list of categories on the right hand side of this page are linking to a blank archive page: https://oseaisland.co.uk/blog/

Here is the debug in the admin area...

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='74b9af7e724e28927d79461d0b89cd33' LIMIT 1
UPDATE perch2_users SET userHash='3bf93c4a8a9dce9a7b5d25641ce58cc7' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID

On the blog homepage debug produces this...


Debug Message SELECT * FROM perch2_pages WHERE pagePath='/blog/index.php' LIMIT 1 Using template: /templates/pages/attributes/seo.html SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2015-05-13 09:21:00' ) GROUP BY itemID ORDER BY sortval DESC LIMIT 0, 6 SELECT FOUND_ROWS() AS `count` SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0 Using template: /templates/blog/post_in_list.html SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC Fetching from cache: perch_blog_categories589c7a634eb12f2ec225cfedc7dc78ae Using template: /templates/mailchimp/subscribe.html Array ( [type] => 8 [message] => Constant PERCH_DEBUG already defined [file] => /home/oseaisla/public_html/blog/index.php [line] => 35 )

On the archive.php page, debug produces this....

Debug Message
SELECT * FROM perch2_pages WHERE pagePath='/blog/archive.php' LIMIT 1
Fetching from cache: perch_blog_category48cdcbc297b4eced9d6af6fecb13472b
Cache file not found: perch_blog_category48cdcbc297b4eced9d6af6fecb13472b
SELECT * FROM perch2_categories WHERE catPath='blog/the-times/' LIMIT 1
SELECT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/the-times/%' OR idx.indexKey='_category' AND idx.indexValue='blog/the-times/')
SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' AND idx.itemID IN (NULL) WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2015-05-13 09:20:00' ) GROUP BY itemID ORDER BY sortval DESC LIMIT 0, 10
SELECT FOUND_ROWS() AS `count`
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/blog/post_in_list.html
Fetching from cache: perch_blog_date_archive_monthsf2e7d49784704a5b24102a78c349d57c
SELECT year(postDateTime) as year, COUNT(*) AS year_qty FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2015-05-13 09:20:00' GROUP BY year ORDER BY year DESC
Using template: /templates/blog/months_month_link.html
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2015' AND p.postStatus='Published' AND p.postDateTime<='2015-05-13 09:20:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2014' AND p.postStatus='Published' AND p.postDateTime<='2015-05-13 09:20:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2013' AND p.postStatus='Published' AND p.postDateTime<='2015-05-13 09:20:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2012' AND p.postStatus='Published' AND p.postDateTime<='2015-05-13 09:20:00' GROUP BY year, month ORDER BY month DESC
SELECT DISTINCT year(postDateTime) AS year, month(postDateTime) AS month, CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime, COUNT(*) AS month_qty FROM perch2_blog_posts p WHERE year(postDateTime) = '2011' AND p.postStatus='Published' AND p.postDateTime<='2015-05-13 09:20:00' GROUP BY year, month ORDER BY month DESC
Using template: /templates/blog/months_year_link.html
Caching: perch_blog_date_archive_monthsf2e7d49784704a5b24102a78c349d57c
Fetching from cache: perch_blog_categories589c7a634eb12f2ec225cfedc7dc78ae
Using template: /templates/mailchimp/subscribe.html
Array
(
    [type] => 8
    [message] => Constant PERCH_DEBUG already defined
    [file] => /home/oseaisla/public_html/blog/archive.php
    [line] => 171
)

Within the blog admin area, each post has category checkboxes and most posts have been assigned to a category.

Please help! Thanks

Can anyone help please? Ive been advised that its possibly something to do with Perch blog cache because that shows up in the debug report above.....any ideas?

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can test that by putting your site into development mode. Output isn't cached in that mode.

define('PERCH_PRODUCTION_MODE', PERCH_DEVELOPMENT);

Drew, I have been helping Chris to troubleshoot this issue. I have tried as you suggested to put into Development Mode, but this did not correct the issue, but the cache error did go away.

Basically, on his archive page he is using

perch_blog_categories();

Which correctly outputs a list of Categories with a count for each item. The generated link to the archive is correct. When clicking on the link to an archive the function...

perch_blog_category(perch_get('cat'));

doesn't output anything, but if I add...

print_r(perch_get('cat'));

it is outputting the correct slug, but for some reason the function gives no output otherwise.

I totally re-installed all the default templates in templates/blog and also re-installed perch_blog app.

Drew, A critical step seems to have been over looked.... Just for the heck of it I added /update to the end of the url while in the blog app... and of course it ran the update, then the categories app gained a new Category... Blog, with lots of categories presumably from the existing blog posts.

Now, it's all working... to the best of my knowledge.

Was there somewhere in the doc's telling a person to run update? or... is this normally something that should have run automatically and just didn't happen?

Was there somewhere in the doc's telling a person to run update? or... is this normally something that should have run automatically and just didn't happen?

Robert, there was something in the docs about running an update in a particular kind of way if you are on a slightly older blog version, which I was. It was during that update process I came unstuck.

Anyway, I cannot thank you enough for your help with the issue. Im very grateful!

Hey Chris. If all is good now, go ahead and remove my access to perch and others. It was a pleasure to help and I hope everything goes smoothly from here.