OrientDB - 无法读取套接字

时间:2016-09-19 00:58:18

标签: php server orientdb graph-databases

我想使用OrientDB暂时在服务器上存储一些数据,localhost。使用https://github.com/orientechnologies/PhpOrient中的官方库。 但是,在尝试连接时,我收到以下失败消息:

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

有什么不对?我可以在localhost:2480上连接并进入OrientDB Studio,但这里似乎出现了问题。

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

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

1 个答案:

答案 0 :(得分:4)

尝试使用此代码连接:

<?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端口。 希望它有所帮助。