I am doing the following in PHP:
exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf');
When I run this from the command line, it runs fine and finishes in a second or two.
When I run this command from PHP exec, the java process takes 100% CPU and never returns.
Any ideas?
I have also tried running the above command with '/usr/bin/java -Djava.awt.headless=true'.
I am running Mac OS X 10.5.5, MAMP 1.7, PHP 5.2.5
PHP and Java are not the same as PHP is the server-side scripting language while Java is the general-purpose compiled programming language. PHP creates web applications and dynamics, while Java also powers dynamic web apps. Further, PHP comes as an open-source programming language with strong community support.
Turns out it was a bug specific to the PHP stack MAMP (http://www.mamp.info/).
Turns out any invocation of the JVM following fails under MAMP, e.g.:
exec('java -version');
The fix is to prefix the command with
export DYLD_LIBRARY_PATH="";
Also I realized there's no reason to use that method of invoking mxmlc.
So here's the final, working command:
exec('export DYLD_LIBRARY_PATH=""; mxmlc MyAS3App.as -default-size 360 280 -output MyAS3App.swf');
I manage to get this to work togheter with MAMP. The solution was to include the:
export DYLD_LIBRARY_PATH="";
in the exec call:
$argss = "export DYLD_LIBRARY_PATH=\"\"; /usr/bin/java -jar /Applications/yourjarfile.jar";
$resultXML = exec($argss, $output);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With