LoginSignup
5
5

More than 5 years have passed since last update.

PHP5.6へのGDインストール時にJPEG Supportを有効にする方法

Last updated at Posted at 2016-09-07

概要

php5.6のコンパイル時に--with-gdをつけてGDをコンパイルしたが
そのままではJPEG Supportが有効になっていなかったので対応した。

PNGやGIFはデフォで有効になっていた。

条件

  • CentOS6.8
  • php5.6をソースからインストールした

JPEGライブラリインストール

http://www.ijg.org/ からダウンロードURLをコピーする

## 移動
$ cd /usr/local/src
## tar.gzをダウンロード
$ sudo wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz
## 解凍
$ sudo tar -zxvf jpegsrc.v9b.tar.gz
## 移動
$ cd jpeg-9b/
##コンパイル
$ ./configure --enable-shared
$ sudo make
$ sudo make install
$ cd ..

/usr/local/lib/libjpeg.soが存在することを確認

phpを再コンパイル

## 移動
cd /usr/local/src/php-5.6.24
## 必要なパッケージと--with-gd --with-jpeg-dir=/usr/local/lib/を追記してコンパイル
$ sudo ./configure --enable-mbstring --enable-pdo --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-pear --with-gmp --with-iconv --with-pdo-pgsql --enable-opcache=no --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt=/usr/local/lib --enable-zip --with-zlib --with-curl --with-openssl --with-gd --with-jpeg-dir=/usr/local/lib/
$ sudo make
$ sudo make install
## apache再起動
$ sudo service httpd restart

JPEGが有効になった
2016-09-07 17_35_38-phpinfo().png

参考

PHPでgdを有効にしてるのにjpg supportが有効にならない
libjpegライブラリのインストール

5
5
2

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
5
5