Forum

Thread tagged as: Problem

PHP 7.2+ Cannot modify header information

Hi,

I'm seeing this error when saving a collection item, but only when using PHP 7.2 and 7.3. There's no error when running PHP 7.1.

Warning: Division by zero in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php on line 107

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php:107) in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchUtil.class.php on line 1405

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php:107) in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchUtil.class.php on line 1406

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php:107) in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchUtil.class.php on line 1407

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php:107) in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchUtil.class.php on line 1415

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/lib/PerchImage.class.php:107) in /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/inc/top.php on line 17

Perch information

Perch Runway: 3.1.3
Production mode: Production (100)
Installed apps: content (3.1.3), assets (3.1.3), categories (3.1.3), perch_blog (5.6.1), perch_forms (1.12), perch_mailchimp (3.1)
DB driver: PDO
DB tables: perch3_backup_plans (0), perch3_backup_resources (0), perch3_backup_runs (0), perch3_blog_authors (2), perch3_blog_comments (0), perch3_blog_index (528), perch3_blog_posts (11), perch3_blog_posts_to_tags (0), perch3_blog_sections (1), perch3_blog_tags (0), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (4), perch3_category_counts (1), perch3_category_sets (2), perch3_collection_index (814), perch3_collection_items (46), perch3_collection_revisions (8), perch3_collections (2), perch3_content_index (202), perch3_content_items (52), perch3_content_locks (0), perch3_content_regions (11), perch3_forms (2), perch3_forms_responses (3), perch3_mailchimp_campaigns (2), perch3_mailchimp_imports (5), perch3_mailchimp_lists (4), perch3_mailchimp_subscribers (100), perch3_mailchimp_subscriptions (100), perch3_mailchimp_webhooks (2), perch3_menu_items (13), perch3_navigation (1), perch3_navigation_pages (2), perch3_page_routes (16), perch3_page_templates (30), perch3_pages (14), perch3_resource_log (1294), perch3_resource_tags (0), perch3_resources (836), perch3_resources_to_tags (0), perch3_settings (36), perch3_user_passwords (0), perch3_user_privileges (47), perch3_user_role_buckets (5), perch3_user_role_privileges (20), perch3_user_roles (2), perch3_users (2)
Users: 2
App runtimes:
<?php
    $apps_list = [ 
        'perch_forms',
        'perch_blog',
        'perch_mailchimp'
    ];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
Scheduled tasks for perch_mailchimp: import_data (1 mins)
Editor plug-ins: config.js
H1: 62b1e7e4da7e71f6a85251c05884ab91
L1: 20e36f607d9cb7a8dcd97120d3069bfa
F1: 3b606135b33e6a102526838f4152a807
headerColour: #000000
content_singlePageEdit: 1
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.1.1
update_3.1.1: done
headerScheme: dark
update_runway_3.1.1: done
latest_version:
on_sale_version:
perch_blog_update: 5.6
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 0
sidebar_back_link: 0
hide_pwd_reset: 0
keyboardShortcuts: 0
siteOffline: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
perch_blog_comment_notify: 0
perch_blog_webmention_tx: 0
perch_blog_webmention_rx: 0
perch_blog_site_name: Breathtaking
perch_mailchimp_api_key: XXXXXXX
perch_mailchimp_campaign_url: /mailchimp/campaign/{campaignSlug}
perch_mailchimp_secret: XXXXXXX
helpURL: /guides
logoPath: /perch/resources/logo-cms-gather-content.gif
perch_blog_post_url: /breathtakinglungs/{postSlug}
update_runway_3.1.3: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: apps/preview-public-programmes/public
PERCH_SCHEDULE_SECRET: XXXXXXX
PERCH_DB_USERNAME: XXXXXXX
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: preview-public-programmes
PERCH_DB_PREFIX: perch3_
PERCH_EMAIL_METHOD: smtp
PERCH_EMAIL_HOST: smtp.mailtrap.io
PERCH_EMAIL_SECURE: tls
PERCH_EMAIL_AUTH: 1
PERCH_EMAIL_PORT: 2525
PERCH_EMAIL_USERNAME: XXXXXXX
PERCH_EMAIL_FROM: XXXXXXX
PERCH_EMAIL_FROM_NAME: Public Programmes Team
PERCH_LOGINPATH: /perch
PERCH_PATH: /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch
PERCH_CORE: /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core
PERCH_RESFILEPATH: /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RWD: 1
PERCH_CUSTOM_EDITOR_CONFIGS: 1
PERCH_YOUTUBE_API_KEY: XXXXXXX
PERCH_GMAPS_API_KEY: XXXXXXX
PERCH_RUNWAY: 1
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: 6738d5d5f5664f7c5e34
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
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_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: 7.3.0
Zend: 3.3.0-dev
OS: Linux
SAPI: fpm-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 401a40ebd5e281cf22215acdc170723a1519aaa9 $
MySQL server: 5.7.24-0ubuntu0.16.04.1-log
Free disk space: 21.05 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, calendar, ctype, dom, fileinfo, filter, ftp, hash, iconv, json, SPL, PDO, bz2, posix, readline, Reflection, session, SimpleXML, snmp, soap, sockets, sodium, standard, tokenizer, xml, xmlreader, xmlwriter, zip, mysqlnd, cgi-fcgi, bcmath, Phar, curl, mbstring, gd, gettext, gmp, imap, intl, ldap, exif, mysqli, odbc, pcntl, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, shmop, tidy, xmlrpc, xsl, Zend OPcache
GD: Yes
ImageMagick: No
PHP max upload size: 512M
PHP max form post size: 1024M
PHP memory limit: 256M
Total max uploadable file size: 256M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
TMP: /srv/users/preview-public-programmes/tmp/preview-public-programmes
TEMP: /srv/users/preview-public-programmes/tmp/preview-public-programmes
TMPDIR: /srv/users/preview-public-programmes/tmp/preview-public-programmes
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
USER: preview-public-programmes
HOME: /srv/users/preview-public-programmes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REMOTE_PORT: 26986
SCRIPT_FILENAME: /srv/users/preview-public-programmes/apps/preview-public-programmes/public/perch/core/settings/diagnostics/index.php
SERVER_ADMIN: webmaster@
CONTEXT_DOCUMENT_ROOT: /srv/users/preview-public-programmes/apps/preview-public-programmes/public
REQUEST_SCHEME: https
DOCUMENT_ROOT: /srv/users/preview-public-programmes/apps/preview-public-programmes/public
REMOTE_ADDR: XXXXXXX
SERVER_PORT: 443
SERVER_ADDR: 127.0.0.1
SERVER_NAME: preview.publicprogrammes.co.uk
SERVER_SOFTWARE: Apache/2.4.37 (Unix) OpenSSL/1.0.2g
LD_LIBRARY_PATH: /opt/sp/apache/lib:/opt/sp/apache/lib
HTTP_COOKIE: _ga=GA1.3.1745381145.1544710455; cmsa=1; _gid=GA1.3.2021390069.1545051481; PHPSESSID=f08e2634791fd698b95e586e8fe78c63
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9
HTTP_ACCEPT_ENCODING: gzip, deflate, br
HTTP_REFERER: https://preview.publicprogrammes.co.uk/perch/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
HTTP_DNT: 1
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: close
HTTP_X_FORWARDED_PROTO: https
HTTP_X_FORWARDED_SSL: on
HTTP_X_FORWARDED_FOR: 86.30.197.156
HTTP_HOST: preview.publicprogrammes.co.uk
SCRIPT_URI: https://preview.publicprogrammes.co.uk/perch/core/settings/diagnostics/
SCRIPT_URL: /perch/core/settings/diagnostics/
HTTPS: on
FCGI_ROLE: RESPONDER
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1545052717.1645
REQUEST_TIME: 1545052717
argc: 1
Stephen Meehan

Stephen Meehan 4 points

  • 2 years ago

Stephen,

These are "Warnings" not errors. Versions of PHP 7.1 are running more strict. If these warning are affecting your output then you can always suppress the warnings. I believe because the warnings are being output in turn the header warning is thrown... because obviously output has begun (in the form of a warning).

I have not been able to successfully run Perch above PHP 7.1 in any installation I have tried without similar warnings... I've not totally figured out why yet.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like the dimensions of one or more images can't be read. What sort of images do you have in the collection item?

Ah, there's a .svg file that doesn't have a height and width set. It's most likely that. I thought it was odd it was only doing it on one of the items in the collection.

I use https://jakearchibald.github.io/svgomg/ which removes height and width. Is there a fix in the pipeline?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it have a viewbox?