{"id":81,"date":"2020-02-12T10:36:29","date_gmt":"2020-02-12T10:36:29","guid":{"rendered":"https:\/\/www.lcn.com\/support\/knowledge-base\/troubleshooting-common-php-issues\/"},"modified":"2021-05-21T14:36:36","modified_gmt":"2021-05-21T14:36:36","slug":"troubleshooting-common-php-issues","status":"publish","type":"ht_kb","link":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/","title":{"rendered":"Troubleshooting common PHP issues"},"content":{"rendered":"<p>This guide will explain how to troubleshoot some more common issues with scripting in PHP. For customers using LCN <a href=\"https:\/\/www.lcn.com\/web-hosting\" target=\"_blank\" rel=\"noopener noreferrer\">Web hosting<\/a> and <a href=\"https:\/\/www.lcn.com\/web-hosting\/wordpress\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress hosting<\/a>.<\/p>\n<h3>Turn on error reporting<\/h3>\n<p>If you&#8217;re having problems, one of the first things may want to do is <strong>enable error reporting<\/strong>. Error reporting takes a lot of the guess work out of debugging your code and should give you a good place to start. To turn on error reporting, include these lines of code at the top of your PHP script.<\/p>\n<pre class=\"prettyprint\">ini_set('display_errors',1);  \nerror_reporting(E_ALL);<\/pre>\n<div class=\"container row col-md-24 support-article panel panel-default panel-body\" style=\"background-color: #f6e9db; border-color: #ead9c7; border: 1px solid #ddd; border-radius: 4px; padding: 1% 2%; background-image: url('\/images\/my_account\/highlight.png'); background-position: left top; background-repeat: repeat-x;\">\n<p><span style=\"font-size: 17px;\"><strong style=\"color: #e77600 !important; font-size: 18px;\">Please Note<\/strong>: Remember to turn off error reporting once you have fixed your issue. Leaving it enabled may show unwanted output to your visitors.<\/span><\/p>\n<\/div>\n<h3>Broken Syntax<\/h3>\n<p>Often problems with PHP code are cause by something very simple. Check your syntax and look for broken code highlighting (if your editor supports it).<\/p>\n<h3>PHP code being displayed instead of running<\/h3>\n<p>If you&#8217;re code is being displayed on your website instead of running make sure all your files are saved with the .php extension. Another possible reason for this is that PHP is not enabled on your hosting. <strong>We don&#8217;t enable PHP on our Starter hosting package<\/strong>, so if you wish to run PHP and are using this package you will need to upgrade.<\/p>\n<h3>PHP version compatibility issues<\/h3>\n<p>With the arrival of PHP7 there are a few incompatibilities with older PHP versions as well as new features that aren\u2019t backwards compatible. Before switching your website over to PHP7 we\u2019d advise testing any PHP included in your site.<\/p>\n<p>A list of backward incompatible changes from PHP 5.6.x to 5.7.x can be found <a href=\"http:\/\/php.net\/manual\/en\/migration70.incompatible.php\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> and a list of new features can be found <a href=\"http:\/\/php.net\/manual\/en\/migration70.new-features.php\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a><\/p>\n<p>You can change the version of PHP your web hosting uses from within your LCN account, which you can learn how to do by reading our <a href=\"https:\/\/www.lcn.com\/support\/articles\/how-to-change-php-version\/\">handy guide<\/a>.<\/p>\n<h3>PHP page loads continuously<\/h3>\n<p>If you&#8217;re using loops within your PHP code you may run into problems where by your script seems to never stop loading. A common cause of this problem is that the loop isn&#8217;t counting properly.<\/p>\n<p>One way to debug this is to <i>echo()<\/i> the current count number at the beginning of each loop cycle, this will hopefully give you a better idea of where the problems lies.<\/p>\n<p>If you&#8217;re not using loops and your page is continuously loading you should double check any HTML or Javascript code.<\/p>\n<h3>Advanced troubleshooting and PHP knowledge sharing<\/h3>\n<p>We highly recommend the very active discussion forum (PHP Builder) for discussing all aspects of PHP &#8211; <a href=\"http:\/\/www.phpbuilder.com\/board\/\" target=\"blank\" rel=\"noopener noreferrer\">www.phpbuilder.com\/board<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will explain how to troubleshoot some more common issues with scripting in PHP. For customers using LCN Web hosting and WordPress hosting. Turn on error reporting If you&#8217;re having problems, one of the first things may want to do is enable error reporting. Error reporting takes a lot of the guess work out [&hellip;]<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[15],"ht-kb-tag":[5],"class_list":["post-81","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-creating-a-new-website","ht_kb_tag-web-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Troubleshooting common PHP issues - LCN.com<\/title>\n<meta name=\"description\" content=\"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Troubleshooting common PHP issues - LCN.com\" \/>\n<meta property=\"og:description\" content=\"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/\" \/>\n<meta property=\"og:site_name\" content=\"Customer Support Guides - LCN\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/lcndotcom\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-21T14:36:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/support-facebook-feed.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@lcndotcom\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/\",\"url\":\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/\",\"name\":\"Troubleshooting common PHP issues - LCN.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#website\"},\"datePublished\":\"2020-02-12T10:36:29+00:00\",\"dateModified\":\"2021-05-21T14:36:36+00:00\",\"description\":\"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.lcn.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Troubleshooting common PHP issues\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.lcn.com\/support\/#website\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"name\":\"Customer Support Guides - LCN\",\"description\":\"- LCN\",\"publisher\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.lcn.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\",\"name\":\"LCN.com\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"contentUrl\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"width\":461,\"height\":461,\"caption\":\"LCN.com\"},\"image\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/lcndotcom\",\"https:\/\/x.com\/lcndotcom\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Troubleshooting common PHP issues - LCN.com","description":"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/","og_locale":"en_US","og_type":"article","og_title":"Troubleshooting common PHP issues - LCN.com","og_description":"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.","og_url":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/","og_site_name":"Customer Support Guides - LCN","article_publisher":"https:\/\/www.facebook.com\/lcndotcom","article_modified_time":"2021-05-21T14:36:36+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/support-facebook-feed.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@lcndotcom","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/","url":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/","name":"Troubleshooting common PHP issues - LCN.com","isPartOf":{"@id":"https:\/\/www.lcn.com\/support\/#website"},"datePublished":"2020-02-12T10:36:29+00:00","dateModified":"2021-05-21T14:36:36+00:00","description":"Troubleshooting common PHP issues with LCN.com.This guide takes you though common problems and solutions you may encounter once you start PHP scripting.","breadcrumb":{"@id":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.lcn.com\/support\/articles\/troubleshooting-common-php-issues\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lcn.com\/support\/"},{"@type":"ListItem","position":2,"name":"Troubleshooting common PHP issues"}]},{"@type":"WebSite","@id":"https:\/\/www.lcn.com\/support\/#website","url":"https:\/\/www.lcn.com\/support\/","name":"Customer Support Guides - LCN","description":"- LCN","publisher":{"@id":"https:\/\/www.lcn.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lcn.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.lcn.com\/support\/#organization","name":"LCN.com","url":"https:\/\/www.lcn.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","contentUrl":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","width":461,"height":461,"caption":"LCN.com"},"image":{"@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/lcndotcom","https:\/\/x.com\/lcndotcom"]}]}},"_links":{"self":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":2,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/81\/revisions"}],"predecessor-version":[{"id":1530,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/81\/revisions\/1530"}],"wp:attachment":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-category?post=81"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-tag?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}