简体   繁体   中英

Error https 500 for send email using mb_language PHP on ec2 AWS

now im doing code for send email. this is a simple send email code. i used fresh setup EC2 on AWS to run this code.

for the setup the EC2 server. i run these commend:

sudo yum update -y
sudo yum install -y httpd24 php72 mysql57-server php72-mysqlnd
sudo service httpd start
sudo chkconfig httpd on

following this url https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

this is very simple project for send email. i use 2 file for this

  • index.php (contain form)
  • email.php (contain send email code)

heres is my code on my email.php file for sending the email

<?php

mb_language("Japanese");
mb_internal_encoding("UTF-8");
$to = 'receivee@gmail.com';
$subject = 'send email。';
$subject = mb_convert_encoding($subject, "ISO-2022-JP", "UTF-8,EUC-JP,auto");
$message = "氏名(漢字):
            {$_POST['name']} 
            メールアドレス:
            {$_POST['email']} 
            お問い合わせ内容:
            {$_POST['message']}";

$message = mb_convert_encoding($message, "ISO-2022-JP", "UTF-8,EUC-JP,auto");
$headers = "From: " .mb_encode_mimeheader("ease") ."<receive@gmail.com>";
$send_mail =  mb_send_mail($to, $subject, $message, $headers);

?>

but when i try to run it. display error

HTTP ERROR 500

i check into the error_log the problem is this

PHP Fatal error:  Uncaught Error: Call to undefined function mb_language() in

how do i fix this. please help.

You need to install php72-mbstring .

This can be done by running sudo yum install -y php72-mbstring .

After you run this you will want to reload/restart your apache server for the php module to be enabled.

You can do this by running service httpd restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM