IT TIP

치명적인 오류 : 정의되지 않은 함수 mb_strlen () 호출

itqueen 2020. 12. 7. 21:23
반응형

치명적인 오류 : 정의되지 않은 함수 mb_strlen () 호출


Totorialzine의 소스 코드를 사용하여 기부 센터를 만들려고합니다.

지금까지 모든 것이 잘 작동하지만 하루 종일 고군분투하고 있었고 실제로 코드에 실제로 무엇이 잘못되었는지 파악할 수없는 유일한 문제

방문자가 기부 할 때 페이지에 댓글을 제출하면 얻는 결과는 다음과 같습니다.

Fatal error: Call to undefined function mb_strlen() in /home/yoursn0w/public_html/livetv/premium/thankyou.php on line 14

다음은 php 파일의 코드입니다.

<?php

require "config.php";
require "connect.php";

if(isset($_POST['submitform']) && isset($_POST['txn_id']))
{
    $_POST['nameField'] = esc($_POST['nameField']);
    $_POST['websiteField'] =  esc($_POST['websiteField']);
    $_POST['messageField'] = esc($_POST['messageField']);

    $error = array();

    if(mb_strlen($_POST['nameField'],"utf-8")<2)
    {
        $error[] = 'Please fill in a valid name.';
    }

    if(mb_strlen($_POST['messageField'],"utf-8")<2)
    {
        $error[] = 'Please fill in a longer message.';
    }

    if(!validateURL($_POST['websiteField']))
    {
        $error[] = 'The URL you entered is invalid.';
    }

    $errorString = '';
    if(count($error))
    {
        $errorString = join('<br />',$error);
    }
    else
    {
        mysql_query("   INSERT INTO dc_comments (transaction_id, name, url, message)
                        VALUES (
                            '".esc($_POST['txn_id'])."',
                            '".$_POST['nameField']."',
                            '".$_POST['websiteField']."',
                            '".$_POST['messageField']."'
                        )");

        if(mysql_affected_rows($link)==1)
        {
            $messageString = '<a href="donate.php">You were added to our donor list! &raquo;</a>';
        }
    }
}

?>

phpMyAdmin의 데이터베이스가 업로드 완료되었습니다.

여기에서 설치 지침을 따릅니다.

http://tutorialzine.com/2010/05/donation-center-php-mysql-paypal-api/


이 기능 mb_strlen()은 PHP에서 기본적으로 활성화되어 있지 않습니다. 설치 세부 사항은 설명서를 읽으십시오.

http://www.php.net/manual/en/mbstring.installation.php


이 문제를 해결하려면 php7.0-mbstring 패키지를 설치하십시오.

sudo apt install php7.0-mbstring

For me the following command did the trick

sudo apt install php-mbstring

On Centos, RedHat, Fedora and other yum-my systems it is much simpler than the PHP manual suggests:

yum install php-mbstring
service httpd restart

For me, this worked in Ubuntu 14.04 and for php5.6:

$ sudo apt-get install php5.6-mbstring

In case Google search for this error

Call to undefined function mb_ereg_match()

takes somebody to this thread. Installing php-mbstring resolves it too.

Ubuntu 18.04.1, PHP 7.2.10

sudo apt-get install php7.2-mbstring

참고URL : https://stackoverflow.com/questions/6419102/fatal-error-call-to-undefined-function-mb-strlen

반응형