Winnipeg Photographer


PHP Fatal error: Cannot redeclare functionX()

You might get an error similar to this when writing a php application: Fatal error: Cannot redeclare functioX() in C:\Users\Jared\htdocs\list.php on line 24.

The reason why you are getting this is you created a function that is named the same as a previously declaired function where you created it your self or one that is built into PHP. In my case I had created a function called “readFile($file)”. I didn’t realize that there was already a PHP function that had the same name.

How to resolve the error:

The only way to resolve this issue is by renaming the function you just created to something else. In mycase I could rename the function to: “jaredReadFile($file)”.

Hope this helped you resolve the PHP Fatal error: Cannot redeclare functionX()!


Leave a Reply