Page 1 of 1

How to properly compile PHP with JPEG support?

Posted: Sun Jan 16, 2011 2:41 am
by grob115
Has anyone installed configured PHP to support GD and JPEG? I'm having trouble calling some of the GD image functions (ie ImageCreateFromJpeg) and am wondering which step along the install process is causing the problem.

I first did the following to compile my JPEG library.
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
gunzip jpegsrc.v8b.tar.gz
tar xvf jpegsrc.v8b.tar
cd jpeg-8b
./configure --enable-shared
make
make install

The following files were installed afterward.
/usr/local/lib/libjpeg.a
/usr/local/lib/libjpeg.la
/usr/local/lib/libjpeg.so -libjpeg.so.8.0.2
/usr/local/lib/libjpeg.so.8 -libjpeg.so.8.0.2
/usr/local/lib/libjpeg.so.8.0.2

Since it's a 64-bit OS, I copied them to the lib64 folder by using the following:
cp -rp /usr/local/lib/*jpeg* /usr/local/lib64/.

Then I did the following to compile my PHP.
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql --with-libdir=lib64 --with-zlib' ' --with-gd --with-jpeg-dir=/usr/local


Are there anything wrong with what I've done?

I'm seeing the following when I "make install" for PHP.
libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.3.2/libs'
You may want to add: /usr/local/lib/php to your php.ini include_path

So I did "libtool --finish /usr/local/src/php-5.3.2/libs" and "service httpd restart" but still am having issues. Any ideas?

Re: How to properly compile PHP with JPEG support?

Posted: Sun Jan 16, 2011 3:24 am
by grob115
By the way, saw the following displayed after "make install" of the JPEG library.
The first bit looks like it did exactly what I found, that it installed the files to /usr/local/lib. However, is it okay if I simply copy the files to /usr/local/lib64, or do I have to use libtool again to install the files to /usr/local/lib64? Looks like it suggested to use libtool but not sure how and why.
# make install
make[1]: Entering directory `/usr/local/src/jpeg-8b'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /usr/bin/install -c libjpeg.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libjpeg.so.8.0.2 /usr/local/lib/libjpeg.so.8.0.2
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.8.0.2 libjpeg.so.8 || { rm -f libjpeg.so.8 && ln -s libjpeg.so.8.0.2 libjpeg.so.8; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.8.0.2 libjpeg.so || { rm -f libjpeg.so && ln -s libjpeg.so.8.0.2 libjpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libjpeg.lai /usr/local/lib/libjpeg.la
libtool: install: /usr/bin/install -c .libs/libjpeg.a /usr/local/lib/libjpeg.a
libtool: install: chmod 644 /usr/local/lib/libjpeg.a
libtool: install: ranlib /usr/local/lib/libjpeg.a
libtool: finish: PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/bin/sh ./libtool --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/cjpeg /usr/local/bin/cjpeg
libtool: install: /usr/bin/install -c .libs/djpeg /usr/local/bin/djpeg
libtool: install: /usr/bin/install -c .libs/jpegtran /usr/local/bin/jpegtran
libtool: install: /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
libtool: install: /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
/bin/sh /usr/local/src/jpeg-8b/install-sh -d /usr/local/include
/usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
/usr/bin/install -c -m 644 jerror.h jmorecfg.h jpeglib.h '/usr/local/include'
test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 '/usr/local/share/man/man1'
make[1]: Leaving directory `/usr/local/src/jpeg-8b'