{"id":1597,"date":"2019-02-08T10:35:53","date_gmt":"2019-02-08T10:35:53","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2019\/02\/08\/1583195-how-to-fix-the-php-cannot-redeclare-error-at-hostinger\/"},"modified":"2026-10-29T15:09:17","modified_gmt":"2026-10-29T15:09:17","slug":"1583195-how-to-fix-the-php-cannot-redeclare-error-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/1583195-how-to-fix-the-php-cannot-redeclare-error-at-hostinger\/","title":{"rendered":"How to fix the PHP cannot redeclare error at Hostinger"},"content":{"rendered":"<p>In case you encounter a &ldquo;<b>PHP Fatal error: Cannot redeclare function<\/b>&rdquo; or any similar message on your website, it means that your script is trying to declare the same function multiple times, either due to the function being defined in <b>two or more separate files<\/b>, or two or more <b>places within the same file<\/b><\/p><h2 id=\"h-fix-the-redeclare-error\">Fix the redeclare error<\/h2><p class=\"no-margin\">To fix it, check the full error message for information such as the filename and path:<\/p><ul>\n<li>\n<p class=\"no-margin\">If declared in <b>different files<\/b>, the error message will show in which file this function was previously declared. Check your code and decide in which <b>unique file<\/b> to declare the function, then remove it from any other files<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">For functions included more than once on the <b>same file<\/b>, open the file using the <b><a data-click-id=\"hgr-post-content-link-file-editor\" class=\"intercom-content-link\" href=\"\/support\/7949267-how-to-use-the-file-editor-at-hostinger\/\" target=\"_blank\" rel=\"noopener\">File Editor<\/a><\/b> and use <b><a data-click-id=\"hgr-post-content-link-include_once\" class=\"intercom-content-link\" href=\"http:\/\/www.php.net\/manual\/en\/function.include-once.php\" target=\"_blank\" rel=\"noopener\">include_once<\/a><\/b> instead of <b><a data-click-id=\"hgr-post-content-link-include\" class=\"intercom-content-link\" href=\"http:\/\/www.php.net\/manual\/en\/function.include.php\" target=\"_blank\" rel=\"noopener\">include<\/a><\/b><\/p>\n<\/li>\n<\/ul><p>If you&rsquo;re encountering a different PHP or server error instead, see <a data-click-id=\"hgr-post-content-link-troubleshooting-5xx-errors-at-hostinger\" href=\"\/support\/4714113-troubleshooting-5xx-errors-at-hostinger\/\">troubleshooting 5XX errors at Hostinger.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing &#8220;Fatal error: Cannot redeclare&#8221;<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_content_updated_date":"","include_on_kodee":true,"footnotes":""},"categories":[230],"tags":[],"class_list":["post-1597","post","type-post","status-publish","format-standard","hentry","category-php-advanced"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/1583195-how-to-fix-the-php-cannot-redeclare-error-at-hostinger","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/1583195-como-reparar-el-error-fatal-de-php-no-se-puede-volver-a-declarar-en-hostinger","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/1583195-comment-reparer-php-fatal-error-cannot-redeclare-chez-hostinger","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/1583195-bagaimana-cara-memperbaiki-error-php-fatal-error-cannot-redeclare-di-hostinger","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/support\/1583195-como-corrigir-o-erro-fatal-error-cannot-redeclare-function-no-hostinger","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/1583195-\u044f\u043a-\u0432\u0438\u043f\u0440\u0430\u0432\u0438\u0442\u0438-\u043f\u043e\u043c\u0438\u043b\u043a\u0443-php-cannot-redeclare-hostinger","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1597"}],"version-history":[{"count":3,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1597\/revisions"}],"predecessor-version":[{"id":23464,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1597\/revisions\/23464"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}