Java 1.6 Broken when called by background Symfony task Java 1.6 Broken when called by background Symfony task php php

Java 1.6 Broken when called by background Symfony task


This is the solution of @paaat added. Im just posting to get this question out of the unanswered list.

I've figured out a solution. It seems like a hack but it worked. I'll post it here just incase anyone else runs into the same problem.

As Broken Java Mac 10.6 mentions the DYLD_LIBRARY_PATH must be unset. Not sure why, it seems to be needed on Unix systems but not MacOSX.

If MAMP sets to /Applications/MAMP/Library/lib here's how to disable it: Edit /Applications/MAMP/Library/bin/envvars and comment out the following lines

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"export DYLD_LIBRARY_PATH

So that it looks like this:

#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"#export DYLD_LIBRARY_PATH

This should fix the problem and java 1.6 can run fine.

Be sure to restart your installation of MAMP for the changes to take effect.


This worked! The version of MAMP I'm running, 2.1.3, however has a different contents in the file:

#if test "x$DYLD_LIBRARY_PATH" != "x" ; then#  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"#else#  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib"#fi#export DYLD_LIBRARY_PATH


This worked for me:

<?php  exec('export DYLD_LIBRARY_PATH=""; java -version');?>

References:
- https://drupal.org/node/1257654
- Calling java from PHP exec