2016-09-19 48 views
1

我想使用OrientDB在服務器上存儲一些數據,現在是localhost。使用https://github.com/orientechnologies/PhpOrient的官方圖書館。 但是,試圖連接我碰到下面的失敗消息時:OrientDB - 無法從套接字讀取

Fatal error: Uncaught exception 'PhpOrient\Exceptions\SocketException' with message 
'socket_read(): unable to read from socket [104]: Connection reset by peer' in 
/Library/WebServer/Documents/T1/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/OrientSocket.php on line 147 

什麼可能是錯誤的?我可以連接到本地主機上的OrientDB Studio:2480,但這裏似乎出現了一些問題。

<?php 
require "../vendor/autoload.php"; 
use PhpOrient\PhpOrient; 

$client = new PhpOrient('localhost', 2480); 
$client->connect('root','pwd'); 
echo "1"; 
$client->dbList(); 
?> 
+0

如果答案對您有用,您應該點擊旁邊的複選標記將其標記爲您接受的答案。 –

回答

3

嘗試使用此代碼連接:

<?php 
require "../vendor/autoload.php"; 
use PhpOrient\PhpOrient; 
$client = new PhpOrient(); 
$client->hostname = 'localhost'; 
$client->port  = 2424; 
$client->username = 'root'; 
$client->password = 'pwd'; 
$client->connect(); 
echo "DB list: <br /><br /> "; 
echo '<pre>'; print_r($client->dbList()); echo '</pre>'; 
echo "<br /> <br /> DB Listed above successfully!"; 
?> 

您應該使用2424端口。 希望它有幫助。

+1

當然,非常感謝! @Oleksandr – user2069136