**過程驗證出來 sysctl 許多參數還不支援修改* PHP + Apache2 + FreeTds 完全實作出來在 Windows 10 Anniversary 的 Ubuntu - bash,縱然該產品還在Beta版本,但是它已經帶給我很大方便。首先【putty】就省下來,【oracle virtual box VM】 安裝Linux 也省下來一個。另外要驗證,PHP程式連結到SQL Server,它就可以直接上手。:-) 【SOP】 安裝【PHP】+【APACHE2】+【FreeTDS】於
Windows 10 Anniversary 的 Ubuntu - bash如下 How to deploy PHP / Apache2 / Freetds connectivity to Ubuntu 14.04.4 LTS \n \l on Windows 10 Anniversary Edition 1. 安裝Apache2
apt-get install apache2 2. 安裝PHP
apt-get install php5 libapache2-mod-php5
apt-get install php5-sybase 3. 確認PHP
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";' 4. 安裝freetds
apt-get install freetds-dev
apt-get install freetds-bin 5.驗證連線使用tsql
[iyunv@TW:~]$ tsql -H192.168.56.20 -Usuper -Ppass@word1 -DTSQL -p1433
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Default database being set to TSQL
1> select @@version
2> go Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64)
Apr 29 2016 23:23:58
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows Server 2012 R2 Datacenter 6.3 <X64> (Build 9600: ) (Hypervisor) (1 row affected)
1> 6. 使用Computer Name取代IP 連結SQL Server
vi /etc/freetds/freetds.conf ....
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
#注意該部分影響資料庫顯示中文給PHP網頁
client charset = UTF-8 #指定SQL Server 2016資料庫名稱與對應IP
[mia-sql2016c]
host = 192.168.56.20
port =1433
tds version = 8.0 7.驗證tsql透過freetds連結到SQL Server 2016
[iyunv@TW:~]$ tsql -S mia-sql2016c -Usuper -Ppass@word1 -DTSQL
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Default database being set to TSQL
1> select app_name()
2> go TSQL
(1 row affected)
1> **附記** 可能碰到狀況
$ sysctl fs.file-max
sysctl: cannot stat /proc/sys/fs/file-max: No such file or directory
|