English 中文(简体)
PHP中继食肉类
原标题:Running shell_exec( which java ) in PHP return nothing

which java

我从指挥线获得适当的投入(/usr/java/.../bin/java)。 然而,如果我用文件A.S.A.的话,它就会:

<?
  echo  java.   . shell_exec( which java );
  echo  ls.   . shell_exec( which ls );
?>

没有任何东西印出,但我得到适当的结果......

最佳回答

需要两点:

  • the full path to the JVM (it wasn t set in the environment)
  • " 2>&1" at the end of the command line.

例如:

echo shell_exec( /usr/java/jdk6/bin/java -cp myJars.jar MyMainClass arg1 2>&1");
问题回答

我也谈到了这个问题。 我正试图确定,是否在(任何)服务器上安装了<代码>qrencode效用,如果没有安装,则将标识/升值/升值。

考虑到该方案应始终处于标准轨道,我预先确定了“ > ,该编码与可能的双亲地点一致,同时仍然尊重<代码>$PATH可能对该系统作出某种界定。 我认为,你也可以用共同的 Java路使用这种办法:

shell_exec( PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"  .
            which qrencode );




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签