Fixing "Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib\n Referenced from: /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so\n Reason: image not found" after a php Update on a Mac

A few weeks ago, I discovered the Wordpress "Site Health Status" tool. I saw that it recommended upgrading my outdated version of php so, being a good "computer guy", I went ahead and did the upgrade. After the update, I found that I could not view my website. After digging around to remind myself about the

sudo apachectl -k restart

command, I got the error message

httpd: Syntax error on line 183 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so into server: dlopen(/usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib\n Referenced from: /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so\n Reason: image not found

Since I use the Homebrew package manager, I followed the advice to do a

brew upgrade brew cleanup

However, even after doing this, I found I still had the problem. Trying other advice, I tried reinstalling php, and saw advice that filled in the details specific to my computer's environment from this documentation from the Homebrew Formulae page on php:

To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module $(brew --prefix)/opt/php/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
$(brew --prefix)/etc/php/7.4/

This solved the problem! One catch: I had to edit the correct copy of the httpd.conf file. Unfortunately, I wasted several hours repeating the process a few times, editing a copy of the file in a place other than the path indicated right within the error message!

I am glad to have this problem fixed and the site up and running again. Now to get back to my next hobby programming project, which I hope I might publish soon....

Comments

Popular posts from this blog

Using KeePass with Dropbox for Cross-Platform Password Management

Visiting CareLink Site on OS X Mavericks

Website FINALLY Adapted to Apple Silicon