2010-09-27

ubuntu 10.04 要使用freetds 才能連入 mssql

因為我用 php 5.2.x 版的
所以先重裝一次 http://z-win.blogspot.com/2010/05/ubuntu-php-52x.html
最後加上
sudo apt-get install freetds-bin
sudo aptitude install -t karmic php5-sybase
#改freetds 設定(這是我自已要用的)
sudo vim /etc/freetds/freetds.conf
#在[global]加上
text size = 104857600 #大小能到100b
client charset = UTF-8 #預設utf-8
#改mssql_connect的語言
sudo vim /etc/php5/apache2/php.ini
#加入
mssql.charset = "UTF-8"
sudo /etc/init.d/apache2 restart
#test方法
tsql -H mssql.ip -p 1433 -U username
#輸入password後出現 1> 就成功了
#php



#也可以用 匿名主機 方式連入,但mssql 要sp4以上
sudo vim /etc/freetds/freetds.conf
#加入
[mssql_con1]
host = this.con1.server
port = 1433
tds version = 8.0

#test方法
tsql -S mssql_con1 -U username
#輸入password後出現 1> 就成功了

#php測試
<?php
echo mssql_connect('mssql_con1', 'username', 'password') 
? 'success' 
: 'failure';
?> 
當mssql的資料是 uniqueidentifier 在LINUX上的FREETDS 要用  mssql_guid_string 或 在SQL 用 cast(欄位名 as varchar(36)) 轉換字元, 在windows用com 時會自動轉
uniqueidentifier  的說明:
http://technet.microsoft.com/zh-tw/library/ms190215.aspx
php的其它解法可以看:
http://uk.php.net/manual/en/function.mssql-guid-string.php


如果發生:
Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.
請使用底下語法:

SET ANSI_WARNINGS ON
SET ANSI_NULLS ON

參考:
http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/1d501b57-fc58-4fbe-9bec-6c38ad158a62

2010-09-23

Pure-FTPd 為什麼出現 530 Sorry, but I can't trust you

因為 帳號登入的 uid 小於
/etc/pure-ftpd/conf/MinUID
中的數字 ,才會這樣

2010-08-19

有設open_basedir時 phpMyAdmin上載sql問題

當有設open_basedir時,phpMyAdmin,會自動把檔案移動到 自已底下的tmp 資料夾,所以有二個問題要注意
1.tmp要能讀寫
2.php.ini中的upload_tmp_dir不能跟phpMyAdmin/tmp 是同一個

2010-08-10

[轉]Ubuntu / Debian: sudo 出現 unable to resolve host 錯誤解法

雖然 sudo 還是可以正常執行, 但是警告訊息每次出來還是有點煩人, 而這只是機器在反解上的問題, 所以就直接從 /etc/hosts 設定, 讓 dev(hostname) 可以解回 127.0.0.1 的 IP 即可

轉至:http://plog.longwin.com.tw/my_note-unix/2008/11/20/linux-sudo-unable-to-resolve-host-2008

2010-07-06

web 嘸蝦米 ime

web 嘸蝦米 ime :
=============
1.
網.蝦米 Hyper Liu http://liu.twbbs.org/hliu/

2.
行易版 http://boshiamy.com/resource_1.html