• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

SQL DRIVER FOR PHP / MSSQL 2008 Standard Edition (64-bit) SP4 (10.0.6000.29)

Hello,
we have a software developped in PHP that was running under
windows server 2008 R2 64bits - MSSQL 2008 32 bits

we migrate the software yesterday from 32 bits to 64 bits.
and all the troubles began ....

Important to specify that we did the same migration a few weeks ago in our test servers and it works perfectly.

In our production server, one of our big problem is charset .
the soft is using iso-8859-1  (french accent)

we have problem with words with accent like é  (see attached file)

I compared test and production server, and I don't see any difference !
same Apache/2.2.17 (Win32) PHP/5.3.21
same sql driver for PHP:   php_pdo_sqlsrv_53_ts.dll    (3.0.3421)
same windows 2008 R2 Enterprise SP1
same MSSQL 2008 Standard Edition (64-bit) SP4 (10.0.6000.29)
same SQL Server Native CLient 11.0  2011.110.5058.00  15/05/2014

please see attached php info of both servers. do not see important difference.

for connexion I use this code
$iConnect = new PDO($connectString, NULL, NULL);
$iConnect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$iConnect->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_SYSTEM);

Open in new window


Thanks for any help, getting crazy......
production-php-info.txt
test-php-info.txt
snip_20160720165526.png
0
bruno_boccara
Asked:
bruno_boccara
1 Solution
 
bruno_boccaraAuthor Commented:
I tested something right now.

I connected my test apache/php to sql production, and no problem of accent.

so the problem seems to be in apache or in php , not in the sql database setup.....
0
 
Ray PaseurCommented:
This is the "signature" of a character encoding conflict.  Suggest you switch everything to UTF-8.  You must have consistency across all parts of the platform: HTML, PHP scripts, the database.

This article does not address MSSQL specifically, but I believe that the principles are shown correctly.
https://www.experts-exchange.com/articles/11880/Unicode-and-Character-Collisions.html
0
 
Dave BaldwinFixer of ProblemsCommented:
I agree with Ray.  Every time I see that symbol, I switch between UTF8 and ISO-8859 to see which character set the page is using.  I believe PHP 5.3 uses ISO-8859 by default though newer versions have switched to UTF-8.
1
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
bruno_boccaraAuthor Commented:
Hi Ray, you're always the first to help me when eveything goes wrong...(:-) many thanks.

in fact I identified since the beginning that the problem is an encoding issue.

I can't change the whole soft right now from 8859 to utf-8, this is an ERP and this step cannot be done "by the way".

I'm getting crazy with this problem because we made everything to avoid issues, and the migration of the test server from SQL 32 bits to 64 bits was Ok .

this ERP is working for more than 10 years, and the last migration from sql 32 to 64 was a very minor change.  Don't you have any direction to search the issue ? I checked almost everything between the 2 servers and I don't see any difference to justify the problem.....
0
 
bruno_boccaraAuthor Commented:
By the way, I listened to you and tried to change some pages to utf-8  (in the test server)

know I have the same problem with strange caracters.

even if for  the connexion I use $iConnect->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8);  instead of PDO::SQLSRV_ENCODING_SYSTEM

do no work ....

I'd really like to move to utf-8 but it seems that it's more simple to say than to do .....
0
 
David Johnson, CD, MVPOwnerCommented:
as a test use mssql management studio and see if it is saved to the DB correctly. Which collation are you using for mssql ? When you installed MSSQL you will have to change the collation from the default.
0
 
Ray PaseurCommented:
...ERP is working for more than 10 years.
That perfectly encapsulates the problem!  Anything written 10 years ago is almost certainly obsolete today - change happens so fast, especially with character encoding.  If we're fortunate UTF-8 will be with us for a bit longer than ISO-8859-1 was.  Check this chart to see how things have changed in recent years.
https://commons.wikimedia.org/wiki/File:UnicodeGrow2b.png

It's not "easy" but all it really requires is consistency across all parts of the platform.  See if this presentation deck might be helpful.
http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
0
 
bruno_boccaraAuthor Commented:
I updated my ERP to utf-8.

 I also setup Apache to utf-8

everything is working fine.
0
 
Ray PaseurCommented:
Wonderful!  I'm hoping that UTF-8 answers a multitude of encoding problems.  It's so elegantly simple that there is no longer any excuse to go back to the old ways.

Cheers, ~Ray
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now