Solved

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

Posted on 2016-07-20
9
60 Views
Last Modified: 2016-07-21
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
Comment
Question by:bruno_boccara
9 Comments
 

Author Comment

by:bruno_boccara
ID: 41721295
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
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 41721565
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
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 41721697
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
 

Author Comment

by:bruno_boccara
ID: 41721775
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:bruno_boccara
ID: 41721812
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
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 41721942
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
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 41721970
...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
 

Author Closing Comment

by:bruno_boccara
ID: 41723055
I updated my ERP to utf-8.

 I also setup Apache to utf-8

everything is working fine.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 41723098
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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now