PHP Fatal error: Cannot redeclare

If you see error message 'PHP Fatal error: Cannot redeclare function' or similar error message in your script, it means there is a problem with your script code (it tries to declare the same function multiple times).

This error says that your function is already defined. This could mean:

  • you have the same function defined in two files
  • you have the same function defined in two places in the same file
  • the file in which your function is defined is included two times (so, it seems the function is defined two times)

To help with the third point, a solution would be to use include_once instead of include when including your functions.php file -- so it cannot be included more than once.

  • PHP Fatal error, Cannot redeclare function, message, error, include_once
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Is allow_url_fopen enabled on your servers?

PHP function allow_url_fopen is enabled on all of our Shared Hosting packages. 

Do you support GCC compiler?

GCC compilers are not supported on Ultahost.com our servers. You can still install it on our VPS...

How to turn off PHP error reporting?

To turn off PHP error reporting you can use the following snippet in your PHP script:...

I get 'unexpected T_STRING' error

You may get this error because all .html files are parsed as PHP here. So, if your .html file...

Parse error: syntax error, unexpected T_PRIVATE

If you get error message 'unexpected T_PRIVATE' or similar error in your script, make sure your...