0

I have two servers running the following Versions of PHP and MySQL respectively

Server 1:

PHP version 5.2.7
MySQL: 5.5.36

Server 2:

PHP version 5.4.23
MySQL: 5.5.36

As the MySQL version is updated, MySQL can handle utf8mb4_general_ci

So in case of server 2 all special characters like ','' etc inserts as it is in Database with no escape slashes.

But where as coming to server 1

The special characters are not inserting as it is, It shows the following way It\'s instead of It's

So I doubt is PHP version making the difference?

I am using Codeigniter configured equally on both servers.

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
Ramaraju.d
  • 1,301
  • 6
  • 26
  • 46
  • 2
    pls make sure magic quotes is turned off.. – reikyoushin Mar 06 '14 at 17:54
  • Thanks for the reply @reikyoushin Ya i found that magic_quote_gpc is On on server1, but magic_quotes_gpc is not found on server 2. Is that the issue? – Ramaraju.d Mar 06 '14 at 19:38
  • @Ramaraju.d `magic_quotes_gpc` is not found on server 2 because “This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.” So you disable it in versions of PHP older than 5.4 (such as the 5.2.7) you have on server 1 & it is a non-issue in 5.4 or higher (like on server 2) because it simply does not exist anymore in PHP 5.4. http://www.php.net/manual/en/security.magicquotes.php – Giacomo1968 May 04 '14 at 17:07

1 Answers1

1

As to the question asked in the title, native PHP strings are just byte strings and thus support 4-byte UTF-8 characters to the same extent that they support UTF-8 characters with fewer bytes. The multibyte-character-aware PHP functions appear to support 4-byte characters, based on a glance at this manual page.

As identified in the comments, your real issue here is that magic quotes is on on one server but not the other. You should probably turn it off. If you want your code to be portable, it way be worth taking the time to write code that can cope with magic quotes being either on or off.

Hammerite
  • 21,755
  • 6
  • 70
  • 91