[SOLVED] PHP Fatal error: Call to undefined function?


So i have a problem with my website when im hosting it on my webhost.
i get this error:

PHP Fatal error:  Call to undefined function getSkillIcons()

The weird thing is that locally(Xampp) it works just fine.

This is how i included the function(in index.php):

<?php include 'http://sub.website.com/incl/Settings.php'; ?>

this is where i call it (index.php):

<div class="panel-body" style="text-align:center">
<?php getSkillIcons(explode(',', skills)); ?>

This how i defined skills (settings.php)

define("skills", "Test1,Test2,Test3,Test4");

this is the function itself: (settings.php)

function getSkillIcons($skills) {
    echo '<a href="?skill=Overall" title="Overall" data-toggle="tooltip"            data-placement="top"><img src="http://sub.website.com/incl/img/skill_icons/Overall-icon.png" class="skill-icon"></a>';
    for ($i = 0; $i < count($skills); $i++) {
        $tooltip = 'title="'.$skills[$i].'" data-toggle="tooltip" data-placement="top"';
        echo '<a href="?skill='.$skills[$i].'" '.$tooltip.'><img src="http://sub.website.com/incl/img/skill_icons/'.$skills[$i].'-icon.png" class="skill-icon"></a>';


Call to undefined function error clearly shows that its not getting your function where you have defined. Reason is you are attaching full path of settings.php file with http.

You need to include settings.php file without http path at the top of ‘index.php’ and make sure settings.php file is located in your project only. If it is located at the same folder with index.php, then simply include like below.

<?php include __DIR__.'/settings.php'; ?> 

If your settings.php file is located in some other folder then you can use $_SERVER[‘DOCUMENT_ROOT’] to include that file like below:

$path .= "/yourpath/settings.php";

Answered By – Amit Gupta

Answer Checked By – Jay B. (BugsFixing Admin)

Leave a Reply

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