anon445699
anon445699

Reputation:

Fatal error: Call to undefined function checkdnsrr()

My application checks MX-records on the registration page. It works fine on my local development machine (Windows 7 with WAMP Server) and on my hosting account (Linux server). Recently I deployed the app on another hosting account and I got the following error when I tried to register an user:

Fatal error: Call to undefined function checkdnsrr() in D:\home\memorytreephoto.com\wwwroot\MyCMS\controls\register\validate_email.php on line 27

My code is below:

<?php
// ------------------------------------------------------------
// VALIDATE E-MAIL
// ------------------------------------------------------------
if (!filter_var($txbEmail, FILTER_VALIDATE_EMAIL)) {
    $emailNotValid = $email_error;
    $emailvalidate_error = 1;
}

if (filter_var($txbEmail, FILTER_VALIDATE_EMAIL)) {
    if (domain_exists($txbEmail)) {
        $emailvalidate_error = 0;
    } else {
        $emailNotValid = $emailmx_error;
        $emailvalidate_error = 1;
    }
}

// Check if MX-records are present
function domain_exists($emailtocheck, $record = 'MX') {
    list($user, $domain) = preg_split('/@/', $emailtocheck);
    return checkdnsrr($domain, $record);
}
?>

Does someone know how to fix this?

Upvotes: 1

Views: 3346

Answers (3)

Joana
Joana

Reputation: 1

Maybe you need to remove the checkdnsrr from disable_functions at php.ini file or maybe your hosting provider do not have this fuction in the php.ini. Check this also, another ideas about PHP version.

Upvotes: 0

Pekka
Pekka

Reputation: 449385

A look in the manual shows that this function exists on Windows only since PHP 5.3.0. You'd have to upgrade to that PHP version to make the function work.

Alternatively, there is a PEAR Class that provides the functionality to PHP versions < 5.3.0

Upvotes: 3

ceejayoz
ceejayoz

Reputation: 179994

This function is only available in PHP 5.3.0 or higher if you're running Windows.

Upvotes: 1

Related Questions