Forum

Thread tagged as: Problem, Add-on-development

Sample App - Error

Hi guys,

One of the apps I'd developed has recently fallen over, and in debugging it I downloaded and installed the Sample App (so I had a fresh copy to compare against), and found that it's experiencing the same error as my app:

Fatal error: Class 'PerchAPI_Factory' not found in /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/addons/apps/my_sample/MySample_Things.class.php on line 4

Any ideas?

Harry Ray

Harry Ray 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Could you be missing files?

It's a fresh download of the Sample app, so I'm not sure that's the case - I'm seeing the exact same error in my custom app as well.

If a missing file caused this, which file would it be?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

That's a core Perch file being referred to: PerchAPI_Factory

Hi Rachel,

Thanks for the help - I'm looking through the core folder but I'm not really sure where that file is supposed to come up - could you point me in the right direction?

None of the other apps on the site are having an issue at this stage.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's changed between when your app was working and now?

As far as I can remember, I've not touched the app code since launch, although there may have a been a Perch update along the way.

Where might I find PerchAPI_Factory, to determine whether the file is present or not?

Here's my diagnostics report:

PERCH INFORMATION

Perch: 2.8.15
Production mode: Production (100)
Installed apps: content (2.8.15), assets (2.8.15), categories (2.8.15), perch_blog (5.0), perch_events (1.9.2), perch_forms (1.8.3), my_sample (2.1), tfd_xreceiver (2.1)
DB driver: PDO
DB tables: perch2_blog_authors, perch2_blog_comments, perch2_blog_index, perch2_blog_posts, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_blogs, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_events, perch2_events_categories, perch2_events_to_categories, perch2_forms, perch2_forms_responses, perch2_my_sample_things, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users, perch2_xreceiver_listings
Users: 4
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_blog',
        'perch_forms',
        'perch_events',
        'tfd_xreceiver'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Scheduled tasks for perch_events: update_category_counts (60 mins)
Editor plug-ins: markitup
H1: eb61a4c62fa62edcd4fa5cea6ac7ab23
L1: 730016cb1044393f92311f663291f567
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.15: done
latest_version: 2.8.15
on_sale_version: 2.8.34
perch_blog_update: 5.0.1
perch_blog_post_url: /news/post.php?s={postSlug}
headerScheme: light
perch_blog_site_name:
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_comment_notify: 0
perch_events_update: 1.8
perch_events_detail_url: /news/events/event.php?s={eventSlug}
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: infosec_tfd
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: admin_infosecDB
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: jamesh@thirdfloordesign.co.uk
PERCH_EMAIL_FROM_NAME: James Holmes
PERCH_LOGINPATH: /cms
PERCH_PATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms
PERCH_CORE: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/core
PERCH_RESFILEPATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_HTML5: 1
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_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.4.13
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.30
MySQL server: 5.5.30
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, curl, dom, fileinfo, gd, imagick, imap, json, ldap, exif, mcrypt, mysql, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, Phar, snmp, sqlite3, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
PATH: /sbin:/usr/sbin:/bin:/usr/bin
PP_CUSTOM_PHP_INI: /var/www/vhosts/system/infosec.thirdfloordigital.net/etc/php.ini
PP_CUSTOM_PHP_CGI_INDEX: fastcgi
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REMOTE_PORT: 38106
SCRIPT_FILENAME: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/core/settings/diagnostics/index.php
SERVER_ADMIN: jamesh@thirdfloordesign.co.uk
DOCUMENT_ROOT: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs
REMOTE_ADDR: 82.35.54.156
SERVER_PORT: 80
SERVER_ADDR: 205.186.165.244
SERVER_NAME: infosec.thirdfloordigital.net
SERVER_SOFTWARE: Apache
SERVER_SIGNATURE: <address>Apache Server at infosec.thirdfloordigital.net Port 80</address>
HTTP_COOKIE: _ga=GA1.2.1129731823.1481100377; cmsa=1; PHPSESSID=3dttol6p55eda0ko6rlqjah697
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_REFERER: https://infosec.thirdfloordigital.net/cms/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: close
HTTP_X_ACCEL_INTERNAL: /internal-nginx-static-location
HTTP_X_FORWARDED_FOR: 82.35.54.156
HTTP_X_REAL_IP: 82.35.54.156
HTTP_HOST: infosec.thirdfloordigital.net
UNIQUE_ID: WKwhOc26pfQAAAI5bsoAAAAB
FCGI_ROLE: RESPONDER
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1487675705.5005
REQUEST_TIME: 1487675705
Rachel Andrew

Rachel Andrew 394 points
Perch Support

The first thing you need to do is update. I don't even know if the sample app will function on that version of Perch. Our advice assumes you are running the latest version.

Hi Rachel,

I've just updated to the latest version, and I'm still seeing the same error.

Here's my new diagnostics report:

PERCH INFORMATION

Perch: 2.8.34
Production mode: Production (100)
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_blog (5.0), perch_events (1.9.2), perch_forms (1.8.3), my_sample (2.1), tfd_xreceiver (2.1)
DB driver: PDO
DB tables: perch2_blog_authors (4), perch2_blog_comments (0), perch2_blog_index (1951), perch2_blog_posts (76), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (1), perch2_categories (0), perch2_category_counts (0), perch2_category_sets (1), perch2_content_index (1327), perch2_content_items (380), perch2_content_regions (47), perch2_events (29), perch2_events_categories (0), perch2_events_to_categories (0), perch2_forms (3), perch2_forms_responses (292), perch2_my_sample_things (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (10), perch2_pages (27), perch2_resource_log (715), perch2_resource_tags (0), perch2_resources (302), perch2_resources_to_tags (0), perch2_settings (25), perch2_user_passwords (0), perch2_user_privileges (40), perch2_user_role_privileges (25), perch2_user_roles (2), perch2_users (4), perch2_xreceiver_listings (95)
Users: 4
PHPMailer: 5.2.21
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_blog',
        'perch_forms',
        'perch_events',
        'tfd_xreceiver'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Scheduled tasks for perch_events: update_category_counts (60 mins)
Editor plug-ins: markitup
H1: eb61a4c62fa62edcd4fa5cea6ac7ab23
L1: 730016cb1044393f92311f663291f567
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.15: done
latest_version: 2.8.15
on_sale_version: 2.8.34
perch_blog_update: 5.0.1
perch_blog_post_url: /news/post.php?s={postSlug}
headerScheme: light
perch_blog_site_name:
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_comment_notify: 0
perch_events_update: 1.8
perch_events_detail_url: /news/events/event.php?s={eventSlug}
update_2.8.34: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: infosec_tfd
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: admin_infosecDB
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: jamesh@thirdfloordesign.co.uk
PERCH_EMAIL_FROM_NAME: James Holmes
PERCH_LOGINPATH: /cms
PERCH_PATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms
PERCH_CORE: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/core
PERCH_RESFILEPATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_HTML5: 1
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_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.4.13
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.30
MySQL server: 5.5.30
Free disk space: 44.37 GB
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, curl, dom, fileinfo, gd, imagick, imap, json, ldap, exif, mcrypt, mysql, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, Phar, snmp, sqlite3, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
PATH: /sbin:/usr/sbin:/bin:/usr/bin
PP_CUSTOM_PHP_INI: /var/www/vhosts/system/infosec.thirdfloordigital.net/etc/php.ini
PP_CUSTOM_PHP_CGI_INDEX: fastcgi
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REMOTE_PORT: 40896
SCRIPT_FILENAME: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs/cms/core/settings/diagnostics/index.php
SERVER_ADMIN: jamesh@thirdfloordesign.co.uk
DOCUMENT_ROOT: /var/www/vhosts/infosec.thirdfloordigital.net/httpdocs
REMOTE_ADDR: 82.35.54.156
SERVER_PORT: 80
SERVER_ADDR: 205.186.165.244
SERVER_NAME: infosec.thirdfloordigital.net
SERVER_SOFTWARE: Apache
SERVER_SIGNATURE: <address>Apache Server at infosec.thirdfloordigital.net Port 80</address>
HTTP_COOKIE: cmsa=1; _ga=GA1.2.1129731823.1481100377; _gat=1; PHPSESSID=3dttol6p55eda0ko6rlqjah697
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_REFERER: https://infosec.thirdfloordigital.net/cms/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: close
HTTP_X_ACCEL_INTERNAL: /internal-nginx-static-location
HTTP_X_FORWARDED_FOR: 82.35.54.156
HTTP_X_REAL_IP: 82.35.54.156
HTTP_HOST: infosec.thirdfloordigital.net
UNIQUE_ID: WKxlWc26pfQAACcAM7gAAAAD
FCGI_ROLE: RESPONDER
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1487693145.8768
REQUEST_TIME: 1487693145
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does your app have an autoloader?

I'm not sure what that is.

Both the Sample App and my app are displaying the same error. My app was built using the Sample App as a guideline.

The other apps don't seem to be experiencing any issues at this stage.