Forum

Thread tagged as: Problem, Error, Twitter

Scheduled tweets are not posting

Hi,

A client's website, which has been live for some time, has stopped sending scheduled tweets. It's receiving the feed of posted tweets OK though. I've worked through the following steps to try and track down the problem:

  • Checked that Perch core and the Twitter app are the latest versions
  • Deleted the tweet fieldtype, as that was still there and the Twitter app upgrade instructions say remove it
  • Regenerated the Twitter app API keys, and forced Perch to re-authenticate with Twitter
  • Hit the scheduled tasks script directly, which did return an error similar to this one, but I ran repair on the relevant database tables and the error stopped
  • Checked that the cron task on the server (which hits the script every ten minutes) was present and correct

No luck so far. Do you have any suggestions?

Thanks!

Perch: 3.0.10, PHP: 7.0.6, MySQL: 5.5.57, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_blog (5.6.1), perch_forms (1.9.1), perch_gallery (2.8.9), perch_kraken (1.1), perch_twitter (3.7)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_gallery', 'perch_twitter' );
PERCH_LOGINPATH: /perch
PERCH_PATH: /nfs/c09/h06/mnt/209271/domains/ninadar.com/html/perch
PERCH_CORE: /nfs/c09/h06/mnt/209271/domains/ninadar.com/html/perch/core
PERCH_RESFILEPATH: /nfs/c09/h06/mnt/209271/domains/ninadar.com/html/perch/resources
Image manipulation: GD
PHP limits: Max upload 99M, Max POST 99M, Memory: 99M, Total max file upload: 99M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: www.ninadar.com
DOCUMENT_ROOT: /home/209271/domains/ninadar.com/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Alex Hardy

Alex Hardy 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What output do you see in the scheduled task log?

Are there any errors in your PHP log?

Hi, no errors in the PHP log. The scheduled task log shows the post_tweets task running, but no tweets posted.

Hmm, oddly after a brief bit of host downtime, it now seems to be working :S

Edit: Nope, it seemed to work once, then didn't work again.

I've set up a new staging site on another host, and I'm getting the following error when the script runs (I've x-ed out the secret):

php /home/madewith/public_html/subdomains/ninadar/perch/core/scheduled/run.php xxxxxxxxxx
Unable to create required database tables.
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does your MySQL user have permission to create tables?

Yes, it has all privileges, including create. I imported a SQL file under that account in phpMyAdmin, and that worked fine.

These are the tables that exist for the Twitter app:

  • perch2_twitter_scheduled_tweets
  • perch2_twitter_settings
  • perch2_twitter_tweets

There's also the Perch core tables that I'd expect to be relevant:

  • perch2_scheduled_tasks
  • perch2_settings

Does something appear to be missing? Perhaps a new table for the Twitter app that a recent update should have added?

Do you think dropping the perch2_twitter_* tables would for it to reinstall and fix the issue?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's the perch2_scheduled_tasks it would've been complaining about. Is it all working now?

It works if I hit the script directly, but it doesn't seem to work on schedule.

Other scheduled tasks, like update_tweets, are working – so I guess that rules out a problem with the cron task?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's the same code than runs both times. Do you have any conditional testing on hostname in your config file?

Yeah I figured as much, but I am using a hostname switch statement as recommended on this article. Perhaps that's causing the problem, although it's a little odd that it was previously working.

I can modify the config files across dev, staging and live to not have that and see if that sorts it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to remember that there's no HTTP request with a cron job, so make sure the default case works for the production server.

Yeah, that's how it's set up. I'll modify the config files and get back.