Search code examples
phpmacoshomebrewjpeg

Brew library version mismatch when running PHP


After installing the php71 package with Homebrew using brew install php71

I get this error when I run PHP:


dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
[1]    55097 abort      php -v

Running brew info jpeg I get this output:

jpeg: stable 9b (bottled)
Image manipulation library
http://www.ijg.org
/usr/local/Cellar/jpeg/9b (20 files, 724KB) *
  Poured from bottle on 2017-08-07 at 16:11:22
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jpeg.rb

It looks like I need to install jpeg version 8b and not 9b; how can I do this?


Solution

  • Just faced a very similar problem.

    Did this:

    1. Uninstalled PHP 7.1

      brew uninstall php71
    2. Installed From source:

      brew install --build-from-source php71

    And now when I do php -v I get:

    PHP 7.1.7 (cli) (built: Aug  7 2017 13:05:56) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    

    Solution was found on this post.

    Edit: second command missed formula name