Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
889 views
in Technique[技术] by (71.8m points)

pdo - After PHP 7.4.14 Update I have some SQL errors

After update of PHP at 6.1.2021 from 7.4.13 to 7.4.14 I have some errors which was not before. MySql is 5.7.32. I have sqls thru:

$prep = $dbconn->prepare($sql);
$prep->execute();

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-server = utf8mb4_unicode_ci' at line 1; Query:SET collation-server = utf8mb4_unicode_ci

1115 Unknown character set: 'utf8mb4_unicode_ci'; Query:SET character_set_connection = utf8mb4_unicode_ci

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SESSION sql_mode = "NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUT' at line 1; Query:SESSION sql_mode = "NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

On my server at same day was updated also PHP 7.3 to 7.3.26. Same scripts running on 7.3 has no problems.

Before this update was everything OK.

question from:https://stackoverflow.com/questions/65641699/after-php-7-4-14-update-i-have-some-sql-errors

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It seems that you have a script that creates a mysql connection with the charset. utf8mb4_unicode_ci

And your mysql does not know this charset.

1115 Unknown character set: 'utf8mb4_unicode_ci'; Query:SET character_set_connection = utf8mb4_unicode_ci

Solutions: Edit the connection string.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...