从php运行solr服务器

从php运行solr服务器,php,solr,jetty,Php,Solr,Jetty,目前,我必须导航到solr的example目录并执行java-jarstart.jar 但是,我希望用户能够通过选择一个选项来自动运行服务器。比方说 1.The user downloads the `solr` directory on his/her server. 2.Enters the location of the example directory he/she just downloaded. 3.Selects/Clicks an option saying "Start So

目前,我必须导航到solr的
example
目录并执行
java-jarstart.jar

但是,我希望用户能够通过选择一个选项来自动运行服务器。比方说

1.The user downloads the `solr` directory on his/her server.
2.Enters the location of the example directory he/she just downloaded.
3.Selects/Clicks an option saying "Start Solr server".
4. And the server is started.

这可能吗?我希望通过
php

来实现这一点,如果您可以通过命令行来实现,那么您可以通过php来实现,假设您的服务器上没有禁用它


注意:如果允许用户输入,那么这是一个非常危险的函数。

我认为您需要类似以下命令的东西来完成此操作。只需将路径添加到给定命令:

<?php 
exec("nohup java -jar start.php > output.log 2>&1 &");

?>

nohup对于将solr进程与php请求解耦非常重要


您的想法是危险的,因为您允许用户输入任何位置来启动脚本。因此,您确实需要考虑路径验证,以确保只启动solr,而不启动任何其他内容。

谢谢。在我的应用程序中,我有许多安全特性。只有管理员有权运行这样的脚本。我想没关系。