Forum How do I...?

Prince on OS X & MAMP?

conord
I've read a few other threads on here with other users having issues getting the PHP interface working. I'm currently trying this in my dev environement (os x, MAMP, PHP5). Prince works fine in the command line. Safe Mode is off. I can execute other commands (like ls) using passthru and exec. However, when I try to run prince, nothing seems to be executed. I've had return codes of 127 (that seems to have been a bad path) and 5 - which I've not been able to figure out.

So the question is - are there any settings or options that need to be addressed in order to have the PHP interface work?

Thanks,

conor
mikeday
Sometimes there have been dynamic linking issues due to MAMP substituting some shared libraries. Can you check if any errors are showing up in the server logs when you try invoking Prince?
conord
Just cleared the apache log out and ran my test again. No errors show up in either the apache or php logs. Another interesting piece is that I set the logfile for prince, but it's not being created. I've tried to create the log file in a dir on my dev site and in /tmp - neither seem to work.
mikeday
Can you make a temporary modification the Prince shell script (installed by default at /usr/bin/prince) to verify that it is actually being invoked? For example, add the line "touch /tmp/prince_is_running" before the exec.
conord
I was able to do that and the prince.is.running file is created.
mikeday
Okay, so shell script is running but perhaps the binary is failing to execute due to a shared library issue. Try commenting out the "exec" line and add this instead:
#! /bin/sh

# exec /... this line is commented out

/usr/lib/prince/bin/prince --version > /tmp/prince.log 2>&1

Then check the output in the /tmp/prince.log file.
conord
Here is what is in the log after running the script with the PHP interface:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
mikeday
MAMP is changing the dynamic library path to substitute an incompatible version of libjpeg for mysterious reasons of its own, making it impossible to run Prince. This is a suggestion from the MAMP developers:
yes, MAMP changes the environment variable $DYLD_LIBRARY_PATH. Check the file:

/Applications/MAMP/Library/bin/envvars

and try out if commenting out the two uncommented lines will work for you.
conord
That did the trick. Thank you for all the assistance!