{"id":1896725,"date":"2019-10-18T13:19:58","date_gmt":"2019-10-18T17:19:58","guid":{"rendered":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/solution-for-error-publishing-failed-on-php-5-6\/"},"modified":"2020-03-30T11:14:25","modified_gmt":"2020-03-30T15:14:25","slug":"solution-for-error-publishing-failed-on-php-5-6","status":"publish","type":"post","link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/solution-for-error-publishing-failed-on-php-5-6\/","title":{"rendered":"Publishing Fails on PHP 5.6"},"content":{"rendered":"\n<p>For sites running PHP 5.6, sometimes you can run into errors like &#8220;Publishing failed&#8221; where a post won&#8217;t publish or update while using the Block Editor.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/support.theeventscalendar.com\/scripts\/file.php?view=Y&amp;file=afcff225b1a995511d4493a70327e11c\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<p>Errors like these can be caused by PHP errors, or notices appearing in the content before the expected response. This&nbsp;is not a bug in our code or something we can resolve. It is a side effect of running outdated PHP.<\/p>\n\n\n\n<p>One common notice is a Deprecated notice with the following text:<\/p>\n\n\n\n<p><kbd>PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php:\/\/input stream instead. in Unknown on line 0<\/kbd><\/p>\n\n\n\n<p>The WordPress&nbsp;Block editor uses <a href=\"https:\/\/core.trac.wordpress.org\/ticket\/31806\">a special request type<\/a> in the REST API which can trigger this on servers that run PHP 5.6. The deprecation notice is triggered by PHP and cannot be avoided.<\/p>\n\n\n\n<p>Check out this <a href=\"https:\/\/www.bram.us\/2014\/10\/26\/php-5-6-automatically-populating-http_raw_post_data-is-deprecated-and-will-be-removed-in-a-future-version\/\" target=\"_blank\" rel=\"noopener noreferrer\">great post explaining the cause of this&nbsp;problem in depth<\/a><\/p>\n\n\n\n<p>A quick solution to this is to set the following value in your php.ini file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">always_populate_raw_post_data = -1<\/pre>\n\n\n\n<p>The good news is that PHP 7.0+ no longer requires or uses this config value, the capability to receive various request types is now baked into PHP itself. We recommend you <a href=\"https:\/\/dev.theeventscalendar.com\/knowledgebase\/k\/php-version-requirement-changes\/\">upgrade from\u00a0PHP 5.6<\/a> soon as it will no longer be supported.\u00a0 See the official <a rel=\"noopener noreferrer\" href=\"https:\/\/wordpress.org\/about\/requirements\/\" target=\"_blank\">WordPress version recommendations<\/a>.<\/p>\n\n\n\n<p>Check out <a href=\"https:\/\/torquemag.io\/2018\/01\/update-php-version-wordpress\/\">How To Easily Check And Update The PHP Version Of Your WordPress Site<\/a>.\u00a0 If you&#8217;re ready to upgrade the version of PHP on your site, please be sure to <a href=\"https:\/\/dev.theeventscalendar.com\/knowledgebase\/k\/creating-site-backups\/\">back up<\/a> and test on a <a href=\"https:\/\/dev.theeventscalendar.com\/knowledgebase\/k\/creating-and-using-a-wordpress-staging-site\/\">staging site<\/a>.<\/p>\n\n\n\n<p>Are you still having issues after adding the code? Visit our <a href=\"https:\/\/support.theeventscalendar.com\/\" data-ytta-id=\"-\">Help Desk<\/a>&nbsp;and let us take a look.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For sites running PHP 5.6, sometimes you can run into errors like &#8220;Publishing failed&#8221; where a post won&#8217;t publish or update while using the Block Editor. Errors like these can be caused by PHP errors, or notices appearing in the content before the expected response. This&nbsp;is not a bug in our code or something we&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[93],"tags":[58],"stellar-product-taxonomy":[161],"class_list":["post-1896725","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-errors","tag-php","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":93,"label":"Troubleshooting"}],"post_tag":[{"value":58,"label":"PHP"}],"stellar-product-taxonomy":[{"value":161,"label":"The Events Calendar"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"zach","author_link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/author\/zach\/"},"comment_info":0,"category_info":[{"term_id":93,"name":"Troubleshooting","slug":"errors","term_group":0,"term_taxonomy_id":93,"taxonomy":"category","description":"","parent":0,"count":67,"filter":"raw","term_order":"0","cat_ID":93,"category_count":67,"category_description":"","cat_name":"Troubleshooting","category_nicename":"errors","category_parent":0}],"tag_info":[{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":128,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1896725"}],"version-history":[{"count":1,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896725\/revisions"}],"predecessor-version":[{"id":1956103,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896725\/revisions\/1956103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1896725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1896725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1896725"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1896725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}