{"id":17363,"date":"2023-01-18T12:07:59","date_gmt":"2023-01-18T06:37:59","guid":{"rendered":"https:\/\/www.milesweb.in\/hosting-faqs\/?p=17363"},"modified":"2023-01-18T16:57:01","modified_gmt":"2023-01-18T11:27:01","slug":"how-to-fix-codeigniter-error-a-php-error-was-encountered","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/","title":{"rendered":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d?"},"content":{"rendered":"\n<p>CodeIgniter generally shows, <strong>\u201cA PHP Error was encountered,\u201d<\/strong> when there are issues in the codes that have been used in the website.<\/p>\n\n\n\n<p>In this article, we will understand the reasons why this CodeIgniter error occurs and the steps to fix it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why Does CodeIgniter, \u201cA PHP Error was Encountered\u201d Appears?<\/h3>\n\n\n\n<p>Besides, the issues in the website code, there are other reasons this error could be triggered, such as poor code structures or any type of issue with the database server. <\/p>\n\n\n\n<p>When this error encounters, you see an error message in the below format:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">A PHP Error was encountered\nSeverity: Warning\n\nMessage: ini_set(): A session is active. You cannot change the session module's ini settings at this time\nFilename: Session\/Session.php\n\nLine Number: 284\n\nBacktrace:\n\nFile: \/home\/cPanelusername\/public_html\/domain.com\/application\/controllers\/Site.php\nLine: 8\nFunction: __construct\n\nFile: \/home\/cPanelusername\/public_html\/domain.com\/index.php\nLine: 318\nFunction: require_once<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"367\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\" alt=\"php error encountered\" class=\"wp-image-17364\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png 626w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered-300x176.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/a><\/figure>\n\n\n\n<p>Here:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Severity:<\/strong> Specifies whether the issue is major or minor. It can be in the form or Notice or Warning.<\/li><li><strong>Message: <\/strong>Shows information about the nature of the error.<\/li><li><strong>File Name: <\/strong>The file name which is causing the issue.<\/li><li><strong>Line Number: <\/strong>The line for checking such error.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"> Steps to Fix the CodeIgniter Error, \u201cA PHP Error was Encountered\u201d <\/h3>\n\n\n\n<p>Here are the steps to fix the CodeIgniter error, \u201cA PHP Error was encountered\u201d:<\/p>\n\n\n\n<p><strong>Step 1<\/strong><\/p>\n\n\n\n<p>Open file application\/config\/config.php and replace http with https like below.<\/p>\n\n\n\n<p><strong><em>$path = &#8220;https:\/\/&#8221;.$_SERVER[&#8216;HTTP_HOST&#8217;].str_replace(basename($_SERVER[&#8216;SCRIPT_NAME&#8217;]),&#8221;&#8221;,$_SERVER[&#8216;SCRIPT_NAME&#8217;]);<br><\/em><\/strong><br><strong>Step 2<br><\/strong><br>In application\/config\/config.php ; sess_save_path should be set as below. Create ci_sessions directory in application folder in domain&#8217;s document root and update ownership<\/p>\n\n\n\n<p><strong><em>$config[&#8216;sess_save_path&#8217;] = APPPATH . &#8216;ci_sessions\/&#8217;;<br><\/em><\/strong><br><strong>Step 3<\/strong><br><br>In index.php find for session_start(); and comment it as below<br><strong><em>\/\/session_start();<\/em><\/strong><\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Thus by following the above steps, you can fix the CodeIgnitor error, <strong>&#8220;A PHP Error was encountered&#8221;.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CodeIgniter generally shows, \u201cA PHP Error was encountered,\u201d when there are issues in the codes that have been used in the website. In this article, we will understand the reasons why this CodeIgniter error occurs and the steps to fix it. Why Does CodeIgniter, \u201cA PHP Error was Encountered\u201d Appears? Besides, the issues in the [&hellip;]<\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[2977,70],"class_list":["post-17363","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-codeigniter","tag-php-error"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb<\/title>\n<meta name=\"description\" content=\"You generally get &quot;A PHP Error was encountered&quot; error in CodeIgniter, when there is an issue in the code of the website. Here&#039;s a guide where we will understand the steps to fix the error.\" \/>\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.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb\" \/>\n<meta property=\"og:description\" content=\"You generally get &quot;A PHP Error was encountered&quot; error in CodeIgniter, when there is an issue in the code of the website. Here&#039;s a guide where we will understand the steps to fix the error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-18T06:37:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-18T11:27:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\" \/>\n<meta name=\"author\" content=\"Nehal Khatri\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nehal Khatri\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\"},\"author\":{\"name\":\"Nehal Khatri\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\"},\"headline\":\"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d?\",\"datePublished\":\"2023-01-18T06:37:59+00:00\",\"dateModified\":\"2023-01-18T11:27:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\"},\"wordCount\":272,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\",\"keywords\":[\"CodeIgniter\",\"PHP error\"],\"articleSection\":[\"How-Tos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\",\"name\":\"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\",\"datePublished\":\"2023-01-18T06:37:59+00:00\",\"dateModified\":\"2023-01-18T11:27:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\"},\"description\":\"You generally get \\\"A PHP Error was encountered\\\" error in CodeIgniter, when there is an issue in the code of the website. Here's a guide where we will understand the steps to fix the error.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png\",\"width\":626,\"height\":367,\"caption\":\"php error encountered\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\",\"name\":\"Nehal Khatri\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png\",\"caption\":\"Nehal Khatri\"},\"description\":\"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/nehal-khatri\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb","description":"You generally get \"A PHP Error was encountered\" error in CodeIgniter, when there is an issue in the code of the website. Here's a guide where we will understand the steps to fix the error.","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.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/","og_locale":"en_US","og_type":"article","og_title":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb","og_description":"You generally get \"A PHP Error was encountered\" error in CodeIgniter, when there is an issue in the code of the website. Here's a guide where we will understand the steps to fix the error.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2023-01-18T06:37:59+00:00","article_modified_time":"2023-01-18T11:27:01+00:00","og_image":[{"url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png","type":"","width":"","height":""}],"author":"Nehal Khatri","twitter_misc":{"Written by":"Nehal Khatri","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/"},"author":{"name":"Nehal Khatri","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb"},"headline":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d?","datePublished":"2023-01-18T06:37:59+00:00","dateModified":"2023-01-18T11:27:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/"},"wordCount":272,"commentCount":0,"image":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png","keywords":["CodeIgniter","PHP error"],"articleSection":["How-Tos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/","name":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d? | MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png","datePublished":"2023-01-18T06:37:59+00:00","dateModified":"2023-01-18T11:27:01+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb"},"description":"You generally get \"A PHP Error was encountered\" error in CodeIgniter, when there is an issue in the code of the website. Here's a guide where we will understand the steps to fix the error.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#primaryimage","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2023\/01\/php-error-encountered.png","width":626,"height":367,"caption":"php error encountered"},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-fix-codeigniter-error-a-php-error-was-encountered\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to Fix CodeIgniter Error, \u201cA PHP Error was Encountered\u201d?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb","name":"Nehal Khatri","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png","caption":"Nehal Khatri"},"description":"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.","url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/nehal-khatri\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=17363"}],"version-history":[{"count":6,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17363\/revisions"}],"predecessor-version":[{"id":17374,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17363\/revisions\/17374"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=17363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=17363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=17363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}