简体   繁体   中英

Install MS SQL Driver On TurnKey Linux

My php version is PHP 7.4.7 and my distro is lsb_release -a gives me

No LSB modules are avaliable
Distributor ID: TurnKey
Description: TurnKey GNU/Linux 9.12 (stretch)
Release: 9.12
Codename: stretch

and if I try to run the command sudo pecl install sqlsrv This is the output that I get

[root@360 ~]# sudo pecl install sqlsrv
downloading sqlsrv-5.8.1.tgz ...
Starting to download sqlsrv-5.8.1.tgz (186,879 bytes)
........................................done: 186,879 bytes
PHP Parse error:  syntax error, unexpected end of file, 
expecting function (T_FUNCTION) or const (T_CONST) in /usr/share/php/Archive/Tar.php 
on line 2383

what do I need to do in order to install this module?

I'm totally unfamiliar with MS SQLserver, and PHP is not a language I have a lot to do with. But I'm intimately familiar with TurnKey, so let me have a crack at getting you going in the right direction: :)

Firstly TBH, I'm not sure whether your support question is a good fit for a Q&A site like this (at least not without much more info about the customisations that you've made and the steps previous to the issue where you find yourself). Regardless, I'll have a crack.

It's probably also worth noting that just in case it's nor clear, your current server is TurnKey v15.x - based on Debian 9/Stretch.

A quick google bought me to the MS docs which note there are some prerequisites. I'm not sure if these are related to your issue, but to ensure we're on the same page, please ensure that you have followed the relevant steps for Debian. Ie as noted in these links:

You also didn't note how/where you installed PHP 7.4 from? I'm assuming that you installed via https://deb.sury.org/ ie followed the Debian steps here: https://packages.sury.org/php/README.txt

Assuming so, then I also suggest making sure that you have the latest version of PEAR installed (ie the one from Ondřej Surý's repo and not the one from Debian). If you want to check, try this:

apt policy php-pear

The Debian Streth version is currently 1.10.1 (full string: "1:1.10.1+submodules+notgz-9+deb9u1"). From what I can gather, the version from sury.org should be 1.10.9 (full string: "1:1.10.9+submodules+notgz-1+0~20191119.13+debian9~1.gbp296d25").

And/or installing like this should do the trick (if you have everything else already set up - probably worth double checking afterwards):

apt update
apt install php-pear

A bit more googling suggests that once you have all that sorted and if you still get that same issue, then try reinstalling Archive_Tar before retrying again:

pear install Archive_Tar

If you still have issues after that, unfortunately, I'm out of ideas. Although it's probably worth reporting the issue to MS? The issue tracker for the msphpsql code is here: https://github.com/microsoft/msphpsql/issues

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM