Forum

Thread tagged as: Problem, Twitter

Twitter App

I've successfully installed the Twitter app and tweets are being downloaded successfully and pulled into the backend.

However, when I add the following function to a page it returns nothing and stops any code below it from running:

<?php perch_twitter_get_latest(); ?>

I've tried using the more complicated examples with parameters and get much the same result.

How can I fix this or at least debug it?

Thank you!

Paul Jackson

Paul Jackson 0 points

  • 3 years ago

Have you simplified this to the point of a php page with just the function and see if works, also, have you viewed the source of the page to see if an error was output before the script died? Sometimes this will be the last lines of the output. Also, a look at your logs may yield answers.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report please?

Perch: 3.0.10
Production mode: Production (100)
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_twitter (3.7)
DB driver: PDO
DB tables: perch3_categories (0), perch3_category_counts (0), perch3_category_sets (0), perch3_content_index (3920), perch3_content_items (210), perch3_content_regions (20), perch3_menu_items (9), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (9), perch3_resource_log (325), perch3_resource_tags (0), perch3_resources (87), perch3_resources_to_tags (0), perch3_scheduled_tasks (3), perch3_settings (20), perch3_twitter_scheduled_tweets (0), perch3_twitter_settings (1), perch3_twitter_tweets (363), perch3_user_passwords (0), perch3_user_privileges (27), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (2)
Users: 2
App runtimes:
<?php
    $apps_list = [ 
    ];
Scheduled tasks for perch_twitter: post_tweets (1 mins), update_tweets (60 mins)
Editor plug-ins:
H1: dc2d3c44bead7bc0f1116fde59232896
L1: 0aa43d68ccbc8ae5ff8d3e7f7d44b757
F1: 3b606135b33e6a102526838f4152a807
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.0.10
update_3.0.10: done
latest_version:
on_sale_version:
headerScheme: light
siteURL: https://79.170.44.83/newmutiny.co.uk/
dashboard: 0
hide_pwd_reset: 0
keyboardShortcuts: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
perch_twitter_update: 3.5
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: cl39-perch-xoe
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: cl39-perch-xoe
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: pacifierpacifies@gmail.com
PERCH_EMAIL_FROM_NAME: Paul Jackson
PERCH_LOGINPATH: /newmutiny.co.uk/perch
PERCH_PATH: /home/sites/newmutiny.co.uk/public_html/perch
PERCH_CORE: /home/sites/newmutiny.co.uk/public_html/perch/core
PERCH_RESFILEPATH: /home/sites/newmutiny.co.uk/public_html/perch/resources
PERCH_RESPATH: /newmutiny.co.uk/perch/resources
PERCH_HTML5: 1
PERCH_SCHEDULE_SECRET: sjdasjkd237kh23j27
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 23f8a1427c17ade109a3
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/sites/newmutiny.co.uk/public_html/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings

PHP: 5.6.32
Zend: 2.6.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.5.5-10.1.24-MariaDB
Free disk space: 3.59 TB
Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, sockets, mbstring, tokenizer, xml, cgi-fcgi, bcmath, curl, dba, dom, enchant, fileinfo, gd, imap, intl, json, ldap, exif, mcrypt, mssql, mysqlnd, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, recode, soap, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader, Zend Guard Loader
GD: Yes
ImageMagick: No
PHP max upload size: 64M
PHP max form post size: 64M
PHP memory limit: 128M
Total max uploadable file size: 64M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PATH: /usr/local/bin:/usr/bin:/bin
UNIQUE_ID: WgH8oCrWj1GkACKHqS@6NAAAAAs
HTTP_HOST: 79.170.44.83
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_REFERER: https://79.170.44.83/newmutiny.co.uk/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,la;q=0.6
HTTP_COOKIE: PHPSESSID=bjijurjlptv2qt67i7bdl42q61; cmsa=1
HTTP_CONNECTION: close
SERVER_SIGNATURE: <address>Apache/2.4.29 (Unix) Server at 79.170.44.83 Port 80</address>
SERVER_SOFTWARE: Apache/2.4.29 (Unix)
SERVER_NAME: 79.170.44.83
SERVER_ADDR: 10.0.44.83
SERVER_PORT: 80
REMOTE_ADDR: 51.7.185.237
DOCUMENT_ROOT: /var/www/html
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: /var/www/html
SERVER_ADMIN: webmaster@extendcp.co.uk
SCRIPT_FILENAME: /home/sites/newmutiny.co.uk/public_html/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 52224
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /newmutiny.co.uk/perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /newmutiny.co.uk/perch/core/settings/diagnostics/index.php
PHP_SELF: /newmutiny.co.uk/perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1510079648.2332
REQUEST_TIME: 1510079648
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to add the app to your config/apps.php file. Those instructions are on the app's installation page if you're unfamiliar with how to do that.

Ah! Neglected to do that. Working now. Thanks for the swift response - much appreciated Drew and Robert!

I've tried setting up a cron job to pull the tweets but I'm having another problem.

I'm running this command:

/usr/bin/php /home/sites/newmutiny.co.uk/public_html/perch/core/scheduled/run.php sjdasjkd237kh23j27

And getting this error in my server logs:

newmutiny.co.uk [Tue Nov 07 19:38:17 2017] [error] [client 79.170.44.6:38522] AH01215: PHP Parse error:  syntax error, unexpected '[' in /home/sites/newmutiny.co.uk/public_html/perch/core/lib/PerchRequest.class.php on line 77: /home/sites/newmutiny.co.uk/public_html/ftpmHcVGK.cgi
Drew McLellan

Drew McLellan 2638 points
Perch Support

The version of PHP you're using on the command line is too old. You need PHP 5.4 or greater.

I'm now running the cron command with PHP 7 and I'm getting the message back: "no secret found". I'm definitely using the secret provided as the URL works correctly. Just not the cron :/

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you providing the secret to the cron job?

Yep like so:

usr/bin/php7 /home/sites/newmutiny.co.uk/public_html/perch/core/scheduled/run.php secret
Drew McLellan

Drew McLellan 2638 points
Perch Support

That should be sufficient.

Telling me no secret found. Could be it anything to do with PHP 7? How can I debug this further?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It shouldn't be PHP 7, no. I'm not sure how you'd debug that without being in front of it, I'm afraid.