7 Replies Latest reply: Apr 7, 2011 8:22 AM by etresoft
Juan.Bangkok Level 1 (0 points)

I updated a library (libpng) and now Apache is complaining that it can't find it. I used homebrew to install the latest ImageMagick (required by a Ruby Gem to code in Ruby). It seems to have installed a more recent version of libpng and now Apache crashes.

The error is:

05/04/11 06:43:29 org.apache.httpd[90200] httpd: Syntax error on line 115 of /private/etc/apache2/httpd.conf: Cannot load /opt/local/apache2/modules/libphp5.so into server: dlopen(/opt/local/apache2/modules/libphp5.so, 10): Library not loaded: /opt/local/lib/libpng12.0.dylib\n Referenced from: /opt/local/apache2/modules/libphp5.so\n Reason: image not found

Do you have any idea of how to revert back to the original version or, if possible, update Apache?

Thanks in advance,

MBP, Mac OS X (10.6.7)
  • etresoft Level 7 (27,813 points)
    Don't do anything to Apache.

    First, explain exactly what you did. It is safe to install things to a Homebrew-specific path like /opt/local. Just don't try to replace anything in /usr.

    Restore your /etc/apache2/httpd.conf file from backup, verify that Apache works, and then, when you have the original system software working normally, explain what software you would like to run, but can't.
  • Juan.Bangkok Level 1 (0 points)
    It's not that easy I fear. The problem isn't with the httpd.conf file, but with the libpng file (now updated to ibpng14.0.dylib) This is one of several libraries updated by homebrew doing a:

    brew install imagemagick

    So Apache no longer can find it.

    It's really hard to rollback to a previous state via backup because I don't know what directories and what files were affected by the homebrew install. If is there a way to reinstall the current version of Apache with all its dependencies, that could be an approach. Otherwise, it seems that for the first time I may need to reinstall the whole OS like in Windows.
  • etresoft Level 7 (27,813 points)
    Homebrew doesn't update any system libraries. Like similar tools, it installs things into it's own directories. I don't think there is any need to reinstall any system software.

    Just humor me and restore a backup of /private/etc/apache2/httpd.conf and see what happens. Then you can explain what you need that the base system doesn't provide.
  • Juan.Bangkok Level 1 (0 points)
    Done: both are exactly the same (it's been a long time since I touched httpd.conf).

    I did remember one important thing that I forgot (since it didn't work): I tried before to install ImageMagick using port. It launched an error message and then I switched to homebrew.

    Maybe the damage was done by Mac Ports?
  • etresoft Level 7 (27,813 points)
    Juan.Bangkok wrote:
    Done: both are exactly the same (it's been a long time since I touched httpd.conf).

    Does it work now?

    Maybe the damage was done by Mac Ports?

    MacPorts is supposed to operate the same way. It may have changed your php.ini file. Restore that to what it was before too.
  • Juan.Bangkok Level 1 (0 points)
    No, it isn't working.

    I've checked php.ini and it has no changes.

    In my /opt/local/lib dir I've the libpng14 library files, not the libpng12. Do you know if the standard one is libpng12?

    If so, Apache httpd.config file points to the old library, so it's seems that somehow this time installing the ImageMagick library -and it's dependencies- updated that library, leaving Apache pointing to the old one.

    I've already tried to get the previous version from the backup and Apache then complains about a different library. I guess the chain of dependencies included several of them.

    I really think that a way to update Apache could fix this. I just didn't find any Apache package in homebrew.
  • etresoft Level 7 (27,813 points)
    Do not touch Apache. You can uninstall Homebrew or any ports/fink package. That includes removal of /opt or /sw directories. Do that first. Then, if it still doesn't work, you may need to reinstall the OS. There is no way to tell just what has been done to your system.