2016-09-19 47 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