1

I am trying to find MSSQL for PHP 7 on a 32 system (Ubuntu, 32-bit) system. But when I try to follow the installation instruction (https://github.com/Microsoft/msphpsql) it seems that it is only for 64 bits systems?

As far as I can see the command curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list returns arch=amd64. Is it possible to get it in 32 bits/i386?

Thanks for any help!

EDIT: Looks like I can use sudo apt-get install php7.0-sybase as an backup solution if I don't get it to work.

1 Answer 1

1

This solved the problem for me:

sudo apt-get install php7.0-sybase

As I need UTF-8 encoding I had to change the version of the tds first:

sudo vim /etc/freetds/freetds.conf

Locate

[global]
    # TDS protocol version
;    tds version = VERSION_NUMBER

Set the current version number to be at least 7.0 and remove ; from the beginning of the line. In order to set UTF-8 global add:

client charset = UTF-8

below the version you just set.

Restart php-fpm:

sudo service restart php7.0-fpm restart

As I use Nginx I restarted that as well just to be sure. Now try adding a mssql connection:

$this->connection = new PDO('dblib:host='.$this->hostname.':'.
                            $port.';dbname='.$this->db_name.';charset=UTF-8'
                            ,$username, $password);

Note the charset=UTF-8 part. This can be removed, but if you don't set the client charset in the config file this is another place were you can set it. If you change the charset in the connection string it will override the global value.

Greetings!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.