ITの隊長のブログ

ITの隊長のブログです。Pythonを使って仕事しています。最近は機械学習をさわりはじめたお(^ω^ = ^ω^)

久々にPHP叩こうとしたらPHP動かんかった

スポンサードリンク

こんなエラーが…

$ php -v
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.9.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Trace/BPT trap: 5

qiita.com

$ brew switch jpeg 9b
Cleaning /usr/local/Cellar/jpeg/8d
Cleaning /usr/local/Cellar/jpeg/9b
17 links created for /usr/local/Cellar/jpeg/9b
$ php -v
Cannot load Xdebug - extension already loaded
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-intl/intl.so' - dlopen(/usr/local/opt/php56-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.57.dylib
  Referenced from: /usr/local/opt/php56-intl/intl.so
  Reason: image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-intl/intl.so' - dlopen(/usr/local/opt/php56-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.57.dylib
  Referenced from: /usr/local/opt/php56-intl/intl.so
  Reason: image not found in Unknown on line 0
PHP 5.6.31 (cli) (built: Aug  7 2017 20:28:16)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

(´・ω・`)

github.com

$ brew uninstall --force php56-intl
$ brew install --force --build-from-source php56-intl
$ php -v
Cannot load Xdebug - extension already loaded
PHP 5.6.31 (cli) (built: Aug  7 2017 20:28:16)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

えくせれんと!!

$ sudo apachectl -k start
httpd: Syntax error on line 171 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/Cellar/php56/5.6.23/libexec/apache2/libphp5.so into server: dlopen(/usr/local/Cellar/php56/5.6.23/libexec/apache2/libphp5.so, 10): image not found

(´・ω・`)

chaika.hatenablog.com

$ brew uninstall php56
$ brew reinstall php56 --without-ldap --with-httpd24
$ ls  /usr/local/Cellar/php56/5.6.31_7/libexec/apache2/libphp5.so
/usr/local/Cellar/php56/5.6.31_7/libexec/apache2/libphp5.so

確認できた。あとはhttpd.confに書いてあるパスを修正すればおわり。