2012-04-23 69 views
2

我一直在嘗試使用phprestsql爲數據庫設置REST接口,但是,儘管我能夠登錄並查看數據庫表,當我試圖查看它們的任何內容時,以下結果:phprestsql配置問題

找不到對象!

在此服務器上找不到請求的URL。如果您手動輸入網址,請檢查拼寫並重試。

如果您認爲這是服務器錯誤,請與網站管理員聯繫。 錯誤404

我phprestsql.ini的內容如下:

[settings] 
baseURL = "/rest" 
[database] 
type = "mysql" 

server = "localhost:3306" 
database = "onthespotpersonnel" 

foreignKeyPostfix = "_uid" 

[renderers] 
text/xml = xml.php 
text/plain = plain.php 
text/html = html.php 

[mimetypes] 
xml = text/xml 
txt = text/plain 
html = text/html 

雖然.htaccess.example包含以下內容:

RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^.*$ index.php 
    #RewriteRule ^.*$ /rest/index.php 

我很新的這種東西所以,任何提議的想法都歡迎:)

ps當我插入3306端口到表內容鏈接(例如http://172.16.2.2:3306/rest/device)出現以下消息:

J��� 
5.5.21�x��T[OXN[aU�ÿ÷�€����������f!l"]4'[email protected]�mysql_native_password� 

我認爲,既然字符出現在HTML文檔以及源這不是一個編碼錯誤...

+0

您需要重命名你的.htaccess.example爲.htaccess,並確保您的重寫規則指向哪裏的index.php是文件夾(在你的情況下,它似乎是/rest/index.php) – Rog 2012-05-07 08:07:56

回答

1

從該mysql_native_password錯誤消息來自MySQL客戶端連接端口。您正嘗試直接連接到MySQL服務。 phprestsql從Web服務器運行並訪問數據庫本身。您可以使用Web瀏覽器通過標準http端口(80)訪問phprestsql。

請嘗試以下配置。輸入用戶名和數據庫密碼,然後連接到http://172.16.2.2/rest/

[settings] 
baseURL = "/rest" 

[database] 
type = "mysql" 
server = "localhost" 
database = "onthespotpersonnel" 
username = "" 
password = "" 
foreignKeyPostfix = "_uid" 

[renderers] 
text/xml = xml.php 
text/plain = plain.php 
text/html = html.php 

[mimetypes] 
xml = text/xml 
txt = text/plain 
html = text/html