PHP 5.3.3 compiled on Mac OS X 10.6 - using /usr/lib when trying to start Apache... rather than /opt/local/lib specified when PHP was configured.

Why is it trying to load from /usr/lib when I specified in my configure not to?

httpd: Syntax error on line 115 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): Library not loaded: /opt/local/lib/libiconv.2.dylib\n Referenced from: /usr/libexec/apache2/libphp5.so\n Reason: Incompatible library version: libphp5.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0

The error message above refers to /opt/local/lib which when I run:

otool -LD /opt/local/lib/libiconv.2.dylib 


/opt/local/lib/libiconv.2.dylib: /opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)

It shows that the version is different than what httpd is erring out as.

I have a feeling I need to recompile Apache using newer libraries, but the error message still doesn't make too much sense to me.

  • How do you start the apache server? – mmmmmm Jan 18 '11 at 16:54
  • /usr/sbin/apachectl -k [graceful|restart|stop...] Apache is running currently, but when I attempt to stop/start/restart (etc.) it the error above kicks out – Anthony Jan 18 '11 at 18:00

As you have files in /opt/local I assume you are using MacPorts. In this case PHP will have been compiled against Apache in MacPorts (in /opt/local/bin), and you will need to configure and start that one, not the default Apple supplied one.

  • I've set my path to use use the PHP binary in /opt/local/bin which is fine. PHP cli is working well, but should I recompile apache as well? Sorry guys, by no means am I a server admin, just trying to learn a bit here. – Anthony Jan 18 '11 at 21:03
  • because you havecompiled php against the macports apache and not the one in /usr/sbin and they have different binary APIs – mmmmmm Jan 19 '11 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.