LoginSignup
1
2

More than 3 years have passed since last update.

phpenvのwebpサーポート

Posted at

メモ的な感じですが、phpenvでgdプラグインのwebサーポートする方法をまとめてみました。私はanyenvベースなので内容をanyenv基準で説明させて頂きます。

build設定の変更

/opt/anyenv/envs/phpenv/plugins/php-build/share/php-build/default_configure_options
--with-gd
--enable-sockets
--with-jpeg-dir=/usr
--with-png-dir=/usr

こちらを以下のように追加します。

/opt/anyenv/envs/phpenv/plugins/php-build/share/php-build/default_configure_options
--with-gd
--enable-sockets
--with-jpeg-dir=/usr
--with-png-dir=/usr
--with-freetype-dir=/usr
--with-webp-dir=/usr

libwebp インストール

上記の状態でphpをインストール(build)すると以下のエラーが出ました。

configure: error: webp/decode.h not found

WebP関係のヘッダーファイルが必要といっていますので同様にlibwebpをインストールします

# sudo yum --enablerepo=epel install libwebp libwebp-devel libwebp-tools

ついでに freetype もインストールしておきます

# sudo yum --enablerepo=epel install freetype freetype-devel

確認

# php -r 'var_dump(gd_info());'
Command line code:1:
array(13) {
  'GD Version' =>
  string(26) "bundled (2.1.0 compatible)"
  'FreeType Support' =>
  bool(true)
  'FreeType Linkage' =>
  string(13) "with freetype"
  'GIF Read Support' =>
  bool(true)
  'GIF Create Support' =>
  bool(true)
  'JPEG Support' =>
  bool(true)
  'PNG Support' =>
  bool(true)
  'WBMP Support' =>
  bool(true)
  'XPM Support' =>
  bool(false)
  'XBM Support' =>
  bool(true)
  'WebP Support' =>
  bool(true)
  'BMP Support' =>
  bool(true)
  'JIS-mapped Japanese Font Support' =>
  bool(false)
}

apacheでの利用ではapacheの再起動を忘れずに。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2