The problem with the Cyrillic alphabet after the PHP upgrade. Where to look?

Hi, friends!

Today on my server, updated PHP. Was 5.3.x, and was 5.4.x. I went to the admin panel of the website and do not see the data. What is important, I do not see the data only those fields where the Cyrillic alphabet. Use Windows-1251. Via phpMyAdmin all the data in place.
Where to dig?
Where to look?
June 27th 19 at 15:26
2 answers
June 27th 19 at 15:28
Try the first query after connection with the base to put
mysql_query('SET NAMES cp1251');
I'm not very good in server issues. At the level of the webmaster, not the administrator. Where exactly to put?

Thank you! - dixie.Haag commented on June 27th 19 at 15:31
In the first script, such as index.php obito is or to connect to a database or a library call for the database connection.

or search for mysql_connect or mysqli_connect - hipolito_Trantow20 commented on June 27th 19 at 15:34
OK, thank you very much. I will try. - dixie.Haag commented on June 27th 19 at 15:37
Example of old code:
if (!@mysql_connect("localhost","root",""))
die("mySQL: failed to connect to server/ Database server-connect error");
if (!@mysql_select_db("base"))
die("mySQL Error select database / Database select error");
mysql_query("SET NAMES utf8");

Depending on libraries to work with the database mysql_query may need to replace the reference to the library, for example $DB->query('
Posomtrite in the code as you execute the queries. - hipolito_Trantow20 commented on June 27th 19 at 15:40
: looking for understand. I thought it simpler to set the same encoding in the script and in the settings of the database and everything should work. - dixie.Haag commented on June 27th 19 at 15:43
: It may still be wiser to start to check the config of PHP? - nikolas.Stark55 commented on June 27th 19 at 15:46
Actually checked what I could. I can't understand anything. :( I guess it's not encoding.

Here again:

1. Lived not grieve. Updated PHP and MySQL. What version was before can't remember, but now 5.4.45 PHP and MySQL 5.5.54;
2. In the admin area of the site data fields of a blank. Some of the data. I noticed that if the field is in Cyrillic, then it will appear empty. Although the list of all the records, there are records with the Cyrillic alphabet. It is unclear how so. I generally always thought that if the problem with encoding, and it appears crooked, but visible.
3. The site displays all the fields except one. It's nothing special, and contains a link (an a tag). That is, the script gets everything perfectly and in a proper encoding;
4. In phpMyAdmin all is fine. Compare cp1251;
5. In php.ini nothing about the encoding .htaccess is 1251.

By the way, the engine is ExpressionEngine 1.

It may have any thoughts? :((( - dixie.Haag commented on June 27th 19 at 15:49
: Look at the work of htmlspecialchars, with some version of the principle has changed and we need a third argument to specify, I do not remember exactly.
Now, with the Toaster:
htmlspecialchars and htmlentities
They have the third parameter is the encoding, prior to PHP 5.4 it was by default, single-byte, now utf-8. Kirillica in cp1251 such functions are converted to the empty string. That's it and you will see.
You should either switch to utf-8 or specify in each function 'cp1251' third argument.

This type here should be: htmlentities($str, ENT_QUOTES, 'UTF-8');

Google. Or evening will tell you more. Very likely that's the problem, it is.
Article on this subject: - hipolito_Trantow20 commented on June 27th 19 at 15:52
Thank you. In General, there's my old script didn't want to work with the new muscolo. Decided not to pull out and made it back. I'm not very experienced in such things and thought that any function backward compatible. A rolling upgrade PHP and MySQL in General, all broke. Had the weight of the server from a backup to restore.

Whatever it was, and thank you for participating and for something that delved into my problem. Thank you! :) - dixie.Haag commented on June 27th 19 at 15:55
June 27th 19 at 15:30
To check 3 places:
1. php config (php.ini)
2. config servers (here you can just .htaccess to score encoding)
3. config database (not likely that it was suddenly changed encoding, but if the first 2 points did not help, go to phpMyAdmin and look there)

Find more questions by tags MySQLServersPHP