3

I got a new mac and installed the same xampp web server as my old one. Everything has been fine except when I call a java file :

$str_exec = "java  -jar HelloWorld.jar";
exec($str_exec, $output,$result);

$output is now an empty array(), and $result = 5

I've tried absolute paths, permissions on everything, changing the user and group in https.conf (none of which I had to do before!)

I swear nothing has changed except I'm now using a macbook pro instead of an air. The files have always matched our main server files. The only thing appearing in the error log is:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Applications/XAMPP/xamppfiles/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

Help please!! I've gone through all the similar threads to this issue on here and can't find anything on the internet anywhere! Gnh

2
  • I'm having the same problem running exec("/usr/bin/php /path/to/file.php"). I get a result of 5 and it doesn't run. I've tried so many things and still beating my head against the wall. Also using XAMPP for PHP 5.3 on macbook air. Commented Jan 28, 2014 at 23:54
  • ok, it appears that xampp sets DYLD_LIBRARY_PATH="/Applications/XAMPP/xamppfiles/lib" which can cause lots of problems. still haven't figured out how to fix it yet. Commented Jan 29, 2014 at 0:45

1 Answer 1

3

EDIT:
Don't use the solution below. It will eventually break, as expected. Mine finally broke, throwing dyld errors when I tried to start the apache server. It wouldn't start at all. No idea why it worked before and doesn't now, but it doesn't matter. Just ditch XAMPP, and follow these instructions to spin up your own stack: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/

Good luck!

ORIGINAL ANSWER:
Ok, I've got a working solution, although I know that it's not the safest by a long shot.

Here's what's up: DYLD_LIBRARY_PATH is a var that modifies the way that the dynamic linking library looks for libs. Apparently many developers think that your software should not use this var. XAMPP does.

According to one solution, you can simply edit out the lines that include this file. (http://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf). Open xamppfiles/bin/envvars with an editor and remove the lines that set and export DYLD_LIBRARY_PATH. Then restart apache.

However, this did not work for me. I also tried the same in a file called xamppfiles/bin/envvars-std. Still didn't work. It may be worth a try though.

The problem is that the XAMPP library conflicts with the mac osx library. So I just (effectively) deleted the XAMPP library. Of course that broke another library, but I continued on deleting the (hopefully redundant) XAMPP libs until it worked. Here's what I had to do:

XAMPP/xamppfiles/lib% sudo mv libjpeg.dylib _changed_libjpeg.dylib XAMPP/xamppfiles/lib% sudo mv libtiff.dylib _changed_libtiff.dylib XAMPP/xamppfiles/lib% sudo mv libpng.dylib _changed_libpng.dylib XAMPP/xamppfiles/lib% sudo mv libiconv.2.dylib _changed_libiconv.2.dylib XAMPP/xamppfiles/lib% sudo mv libexslt.0.dylib _changed_libexslt.0.dylib XAMPP/xamppfiles/lib% sudo mv libxml2.2.dylib _changed_libxml2.2.dylib XAMPP/xamppfiles/lib% sudo mv libxslt.1.dylib _changed_libxslt.1.dylib

After I moved each library to a name where it couldn't find it, I reran the script. It would error on another lib, and I would move it. After a few of these, it stopped. Everything still seems to be working fine in my XAMPP and Apache deployments.

And more importantly, I can now run exec("/usr/bin/php -v"); successfully!

HTH

Sign up to request clarification or add additional context in comments.

3 Comments

Well done Ken! I hope this helps others. I ran out of time and just scrapped xampp and learned how to build the web server from scratch on the mac. Took a few hours, but it works wonderfully and with no bloating!
yeah, i think ditching xampp is probably the better solution
I put to run this answer before call exec. stackoverflow.com/questions/24941078/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.