Fatal error: Call to undefined function myfunction()

Message:

Fatal error: Call to undefined function myfunction() in /www/myproject/index.php on line 1345

Error type: fatal error

Symptoms:

Page parsing fails and you receive that message in the output. If display_errors is set to Off in php.ini you will need to check error logs for the message.

Sample Code:

<?php
$id = $_GET[‘id’];
myfunction($id);
?>

Cause:

You are attempting to call a function which does not exist. If you are trying to call a function that you have defined yourself, then make sure that the script has access to it, or if it is a standard PHP function, check  your spelling  and make sure you have the necessary extensions.

Fix:

Check the file with error indicated in the error output and make sure you didn’t misspell the function name.

If that function is defined in a different file make sure that you include (using include/require) before you call it.

Leave a Reply

Your email address will not be published. Required fields are marked *