Portal Home > Knowledgebase > Articles Database > Location of JPEG lib files for PHP


Location of JPEG lib files for PHP




Posted by grob115, 01-24-2011, 11:56 AM
Can someone let me know which of the following is the correct path for putting the jpeg-8b lib files? /usr/local/lib/ /usr/local/lib64/ I'm running a 64-bit CentOS 5.5, and after executing the following series of commands, I find them in the /usr/local/lib/ area. Do I have to copy them to /usr/local/lib64/? For the record, I have the following files after the above commands. If I simply configure PHP as such.... I'll get this at the very end of the standard out. If I do the following, however, I get a successful output it appears. So it looks like I have to manually copy the library files over. The question is, are these 16-bit libraries good for 64-bit use? Anyway, pressing on, I continued with the following. But I see the following. What exactly do they do? To test if the GD functionality works with PHP, I tried browsing to a page containing the following code. But all I see is just a blank page. What have I done wrong?

Posted by YUPAPA, 01-24-2011, 12:14 PM
Since you installed libjpeg from source and put them in /usr/local, then I think you should use these options compile Please check your phpinfo to see if the extensions/modules are installed correctly. Check with ldconfig before compiling if you are not sure the locations of those libraries.

Posted by grob115, 01-24-2011, 01:27 PM
Thanks for the reply. Questions. 1) You meant. This => ./configure --with-libdir=lib64 --with-jpeg-dir=/usr/local/lib64 --with-png-dir=/usr/local/lib64 ... And not this, right? => ./configure --with-libdir=lib64 --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/lib64 ... 2) What exactly does the "--with-libdir=lib64" do? Does it tell it already to look into the lib64 directory? Or it's telling it to compile it in a different way? 3) I can see in the PHP info that the GD is compiled with JPEG. Just don't know why the page doesn't load up. 4) Any reference sites where I can learn more about "ldconfig"? I can never understand the man pages.

Posted by foobic, 01-24-2011, 07:20 PM
Is there a reason for installing from source rather than just "yum install libjpeg-devel"?

Posted by YUPAPA, 01-25-2011, 01:55 AM
1) yes 2) --with-libdir=lib64 tells to use the lib64 library instead of lib. A long time ago (1 or 2yrs perhaps), I had similar issue compiling and had to use this option to get through. I think this option is meant to be used for php only because of the compile problem. You won't find this when you build other things like apache, etc. 3) If you have compiled gd with jpeg and png support, they should be listed under the GD section (table) from phpinfo. 4) I normally look at the man pages. In short, it looks up the paths in ld.so.conf and caches the links to the shared libraries. Your code works, I think it has something to do with the build and gd stuff. Can you use some die statements to check if there is anything fails? Or set the debug level, etc. Agree! And i always take this approach unless libjpeg needs to be updated to the bleeding edge copy for use with php one for whatever reason. Last edited by YUPAPA; 01-25-2011 at 02:00 AM.

Posted by grob115, 01-25-2011, 11:15 AM
Yes it is listed. Out of curiosity, why does it have to cache the libraries? Isn't it a matter of adding the paths to the $PATH env variable? Any pointers on how to do this? Okay I must have done the other way for some reason. Can't remember why as I've done the yum way for the png also.

Posted by YUPAPA, 01-25-2011, 11:40 AM
Please remove the first line

Posted by YUPAPA, 01-25-2011, 11:50 AM
No, PATH is used for searching the common paths to commands and shared libraries. ldconfig is to used setup links and write to a cache so it speed up access to libraries. For the php question, please ask the php experts I think from php.ini, and if I remember correctly, there are some settings that can set the debug level, etc.

Posted by YUPAPA, 01-25-2011, 01:23 PM
Arrrrgh, found it. You had ' from your code (just copied the functions) while I was testing for the first time. Last edited by YUPAPA; 01-25-2011 at 01:31 PM.

Posted by grob115, 01-27-2011, 10:26 AM
This is exactly it! It works now for this script. Thanks! However, the following is not working. Any idea why?

Posted by grob115, 02-01-2011, 10:48 AM
Tried installing using yum for the jpeg-devel package. But still have problems. But then I'm getting this....

Posted by grob115, 02-03-2011, 06:01 AM
Yupapa, your PM box is full so I'm replying here instead. Finally tried the commands and steps you recommended. Here's the output, after doing the yum install. So I tried the following and it appears to have configured fine. Then I checked if the images are supported with the commands you suggested. Yet after this, I am still getting a blank page for the following.

Posted by YUPAPA, 02-04-2011, 09:15 AM
You are printing binary data, so please remove the echo statements.

Posted by grob115, 02-05-2011, 08:46 AM
Thanks it works now! Re-installing my PHP like this: 1) Use yum for the image libs like this. 2) 3) Configure PHP. I notice you have specified to have it installed under /usr/local/php5. Not sure what's the implication if I don't have this. However, during "make install" I notice the following is displayed. Should I run this also? libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.3.2/libs'

Posted by YUPAPA, 02-05-2011, 10:45 AM
Nope you don't have to run that.

Posted by YUPAPA, 02-05-2011, 10:46 AM
Just to let you know the latest 5.3.5 is already there.

Posted by grob115, 02-05-2011, 12:30 PM
Can you tell me why it's printing this, and what it does? Thanks! That's good to know. Now I need to know how I can update PHP. Do I just download the new tar and re-do everything? Or is there a patch for updates?

Posted by YUPAPA, 02-06-2011, 12:16 AM
Because /usr/local/src/php-5.3.2 is your build directory, it is not necessary to pass it to libtool. If you are going to build executables and link against the libraries there, and that directory is something like /usr/lib64 - those commonly used library directories, then you might have to. Not sure if there are patches or anything, I usually download the latest one and install it to another location. You can generate your own patch by diffing the code if you really want to. Unless you have someone dedicated to modify the php source, then you should.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
WH4L (Views: 680)
Burst packet loss (Views: 644)
need cheap ssl (Views: 627)

Language: