[PHP] Document Indexer and Database Contents Index
Hi All, I'm looking for a PHP program like mnoGoSearch but without the need to recompile it with PHP. Does such a PHP program exist? Basically, I want the program to index file types of .doc, .txt, .html, .pdf, etc. And also the contents of a database data table. Thanks, Kevin
[PHP] Document Indexer and Database Contents Index
Hi All, I'm looking for a PHP program like mnoGoSearch but without the need to recompile it with PHP. Does such a PHP program exist? Basically, I want the program to index file types of .doc, .txt, .html, .pdf, etc. And also the contents of a database data table. Thanks, Kevin
[PHP] Loading Images from PHP broken on Redhat Enterprise
Hi All, Ok, before we start, I know this topic has been flogged to death on how to load images from a database using PHP. So, before we start, I have had this method of loading images in this way working for years. :) However, the problem I've come across has given me a major headache and can't find a solution to the problem. So on to the problem I have 2 servers (setup details below). Server #1 loads the images from the MySQL database using PHP perfectly. However, Server #2, which has identical versions of Apache, MySQL, PHP and were compiled with the exact same parameters, doesn't want to even bother working. The PHP scripts just outputs a bunch of text, which I have seen before if certain headers are incorrectly built. However, there is no difference in the installation of the software, apart from the OS and that fact that Server #2's MySQL RPM was built specifically for Redhat Enterprise 4. Server #1 Fedora Core 2 (fully patched) Apache 2.0.55 (compiled from source) MySQL-4.1.5 (RPM glibc 2.3) PHP-4.4.1 (compiled from source) Server #2 Redhat Enterprise 4 (fully patched) Apache 2.0.55 (compiled from source) MySQL-4.1.5 (RPM Redhat Enterprise 4 version) PHP-4.4.1 (compiled from source) If I export the data from the MySQL database into a file and then call it from the browser, the image shows perfectly, so we're not dealing with corrupt data. I use SQLYog to also administer the databases, viewing the BLOB field using this tool allows me to view the image stored, and it shows perfectly well. Data returned from "httpd -l", "httpd -V", "php -v" and "php -m" show identical builds. Has anyone come across this problem before? Also the httpd.conf and php.ini files are identical in everyway, apart from IP addresses. Many thanks, Kevin Smith smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] Loading Images from PHP broken on Redhat Enterprise
HI Robert, I have checked both phpinfo() and php -i via the cli as follows and both produce the expected results. Also phpinfo() shows the exact same "Configure Command" data for both servers. Server #1 [EMAIL PROTECTED] limiteds_v2]# php -i | grep ini Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini Server #2 [EMAIL PROTECTED] domains]# php -i | grep ini Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini Also both php.ini files have PHPSESSID specifically set to only work with cookies. If this was not the case, the website wouldn't work very well, which the sites do, apart from the images on Server #2. :( Any other ideas? This is a very strange one. To show you what happens, here's the site that works and the one that doesn't: Server #1 (working) http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2 Server #2 (sad and not working) http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2 Regards, Kevin Robert Cummings wrote: On Wed, 2005-11-16 at 18:01, Kevin Smith wrote: Has anyone come across this problem before? Also the httpd.conf and php.ini files are identical in everyway, apart from IP addresses. Did you double check in the phpinfo() output for each server that the php.ini is being loaded for where you think it's being loaded? Cheers, Rob. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] Loading Images from PHP broken on Redhat Enterprise
Hi Curt, In that case, what on earth is going on. This is the script which is on both servers: However, I noticed that if I moved the following lines to the top of the script: header("Content-Type: image/jpeg"); header("Content-Transfer-Encoding: binary"); ..and hard-code the mime type, it outputs the correct headers, apart from "Transfer-Encoding:chunked". Which seems to still screw it up. The content length is wrong (13198), it should be 13184. Looking at the RAW output of the image data, there is a difference. I noticed 3381 was output as part of the image data, yet this is not so on the Server #1, that works. Even if I fix the content-length header to what it should be, it still has some differences. It still bugs me that the data is absolutely fine in the database, as I can save the data out of it into a file and view that file as an image with no problems at all. Anything else you can think of? Thanks, Kevin require('../classes/housekeeping.php'); $db_conn = new HOUSEKEEPING; $limiteds = $db_conn->database(); require('../classes/categories.php'); if ( isset($_GET['image_id']) && isset($_GET['field_id']) && isset($_GET['mime_type']) ) { $image_info = new CATEGORY; $image_info->LINK = $limiteds; $image_info->IMAGE_ID = $_GET['image_id']; $image_info->FIELD_ID = $_GET['field_id']; $image_info->get_thumb_image(); header("Content-Type: ".$_GET['mime_type']); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".strlen($image_info->IMAGE_THUMB)); echo $image_info->IMAGE_THUMB; } elseif ( isset($_GET['image_id']) && isset($_GET['field_id']) ) { $image_info = new CATEGORY; $image_info->LINK = $limiteds; $image_info->IMAGE_ID = $_GET['image_id']; $image_info->FIELD_ID = $_GET['field_id']; $image_info->get_thumb_image(); header("Content-Type: $image_info->MIME_TYPE"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".strlen($image_info->IMAGE_THUMB)); echo $image_info->IMAGE_THUMB; } ?> Curt Zirzow wrote: On Wed, Nov 16, 2005 at 11:44:27PM +, Kevin Smith wrote: HI Robert, Server #1 (working) http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2 Headers for this one: Content-Transfer-Encoding: binary Vary: Accept-Encoding,User-Agent Content-Encoding: gzip P3P: CP="NOI DSP COR NID CUR OUR NOR" Content-Length: 12547 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: image/jpeg Server #2 (sad and not working) http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2 And This one: P3P: CP="NOI DSP COR NID CUR OUR NOR" Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 Something is different. Curt. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] Loading Images from PHP broken on Redhat Enterprise
Solved! I don't believe it, there was an extra carriage return in the require file "housekeeping.php". This carriage return "is" present on Server #1, but Server #2 obviously doesn't like it. I am now going to stick my head out of my window and scream for not thinking that that could have been a possibility. Severely in need of some therapy. Thank you for all your help, Curt and Robert :) Regards, Kevin Curt Zirzow wrote: On Wed, Nov 16, 2005 at 11:44:27PM +, Kevin Smith wrote: HI Robert, I have checked both phpinfo() and php -i via the cli as follows and both produce the expected results. Also phpinfo() shows the exact same "Configure Command" data for both servers. Server #1 [EMAIL PROTECTED] limiteds_v2]# php -i | grep ini Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini Server #2 [EMAIL PROTECTED] domains]# php -i | grep ini Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini Oh and also, you really should check the output of the phpinfo() through the browser, the php cli file could be reading a different file. Also both php.ini files have PHPSESSID specifically set to only work with cookies. If this was not the case, the website wouldn't work very well, which the sites do, apart from the images on Server #2. :( PHP by default uses cookies. Curt. smime.p7s Description: S/MIME Cryptographic Signature