开发者

Problem calling shell script from PHP which calls Java

first I have to tell you, that i'm a french guy, so i can make some mistake with my english ;-)

Here is my problem : I want to use a java processor to transform a XML file. I made a shell script wich is working well. But when I execute the shell script from PHP it doesn't work ...

// I tried this
$resultat = shell_exec("sh ".$chemin."script.sh");
// And after this
$resultat = shell_exec("java -jar ". $jar ." -s:".$source." -xsl:".$xslt);

The file "script.sh" contains this :

JAR='lib/saxon/saxon9he.jar'
SOURCE='temp/fichier_xml.xml'
RESULT开发者_开发百科="temp/output.xml"
XSLT="xml_to_xml.xsl"

java -jar $JAR -s:$SOURCE -xsl:$XSLT

I think that's a problem with JAVA ... But I can not resolve this !!

If you have an idea to help me,

Thanks


Try using the script in backticks i.e. ``


shell_exec('cd ' . $chemin . ' & sh script.sh');
  1. Go to your $chemin dir
  2. Then run your script, as java need correct pathes
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜