How to Fix Configure: Error: jpeglib.h Not Found PHP Compilation

Issue

While compiling PHP from source on CentOS server, we get the error below:

checking whether to enable truetype string function in GD... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-webp-dir=<DIR>
configure: error: jpeglib.h not found.

The root of the problem is we’ve enabled this option –with-jpeg-dir.

./configure --prefix=/usr/local/php7 \
    --with-config-file-path=/usr/local/php7/etc \
    --with-config-file-scan-dir=/usr/local/php7/etc/conf.d \
    --enable-bcmath \
    ...
    --with-freetype-dir \
    --with-jpeg-dir

Solution

In this, we have to install the dependencies packages as follows:

sudo yum -y install libjpeg*
# yum list installed | grep libjpeg
libjpeg-turbo.x86_64                 1.2.90-8.el7                   @base
libjpeg-turbo-devel.x86_64           1.2.90-8.el7                   @base
libjpeg-turbo-static.x86_64          1.2.90-8.el7                   @base
libjpeg-turbo-utils.x86_64           1.2.90-8.el7                   @base

And then try to re-compile PHP from source and it should be able to compile this time.

Leave a Comment

Required fields are marked *