Pages

Wednesday, January 8, 2014

PHP recompile to get JPEG support

How to enable JPEG support in PHP

1. Run the below command to test whether JPEG support is there or not

#php -r 'print_r(gd_info());'

Output :

Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] =>
    [T1Lib Support] =>
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] =>
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] =>
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] =>
)

2. rpm -qa | grep -e libjpeg

if you get output like below

libjpeg-turbo-1.2.1-3.el6_5

then go forward, otherwise install the library

3. check where the library is

find / -name libjpeg*

it may be inside /usr/lib64. Make symbollic link to /usr/lib

ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
ln -s /usr/lib64/libjpeg.so.62.0.0 /usr/lib/libjpeg.so.62.0.0
ln -s /usr/lib64/libjpeg.so.62 /usr/lib/libjpeg.so.62

4. then recompile PHP

goto the php downloaded folder and do "make clean"

then

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --enable-mbstring  --with-gd  --with-pdo-mysql --with-jpeg --with-jpeg-dir=/usr/lib

make

make install

5. Verify JPEG support as below


#php -r 'print_r(gd_info());'

Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] =>
    [T1Lib Support] =>
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] =>
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] =>
)



No comments: