[英]Elasticsearch-PHP application not working
我有一個 Elasticsearch-PHP 應用程序,它可以在本地運行。 但是,當我將其放在僅支持 PHP 5.3 的 RHEL 6 服務器上時,它不起作用。 當我進入控制台時,我得到 GET http://xx.x.xxx.xxx:xxxx/init.php 500(內部服務器錯誤)。 我認為問題可能來自 init.php 中的連接問題。 這是 init.php 中的代碼:
<?php
require_once 'vendor/autoload.php';
use Elasticsearch\ClientBuilder;
/*Build connection*/
$hosts = [
'xx.x.xxx.xxx', // Port
];
$es = ClientBuilder::create() // Instantiate a new ClientBuilder
->setHosts($hosts) // Set the hosts
->build(); // Build the client object
?>
這在本地工作完美。 我不知道為什么當我將它傳輸到服務器時它不起作用。
在 PHP 5.3.10 中,短數組語法不可用,您可以簡單地使用array()
來修復代碼:
$hosts = array(
'xx.x.xxx.xxx', // Port
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.