PHP Classes

Just hang and die

Recommend this page to a friend!

      PHP PDF to Text  >  All threads  >  Just hang and die  >  (Un) Subscribe thread alerts  
Subject:Just hang and die
Summary:just die while processing pdf
Messages:9
Author:Marcel Soler
Date:2016-10-23 05:50:18
 

  1. Just hang and die   Reply   Report abuse  
Picture of Marcel Soler Marcel Soler - 2016-10-23 05:50:18
I tried to convert a pdf file and system just dies. All processing die. I tried to put in a try { catch but it didn't work. Just die process.

You can get the pdf file in link below:
tseyor.org/archivos/triada/comparte ...


I used the same example code. Browser just say me "ERR_CONNECTION_RESET" and nothing load.


include ( '../../PdfToText.phpclass' ) ;

function output ( $message )
{
if ( php_sapi_name ( ) == 'cli' )
echo ( $message ) ;
else
echo ( nl2br ( $message ) ) ;
}

try {
$file = 'sample' ;
$pdf = new PdfToText ( "$file.pdf" ) ;

output ( "Original file contents :\n" ) ;
output ( file_get_contents ( "$file.txt" ) ) ;
output ( "-----------------------------------------------------------\n" ) ;

output ( "Extracted file contents :\n" ) ;
output ( $pdf -> Text ) ;
}
catch(Exception $e)
{
output('Exception!');
}



I tried (in another script) to log in a file after create class (and convert) or if exception ocurr, and nothing written in file.



  2. Re: Just hang and die   Reply   Report abuse  
Picture of Christian Vigh Christian Vigh - 2016-10-23 07:14:29 - In reply to message 1 from Marcel Soler
Hello Marcel,

I tried your sample on my system and everything worked fine.

What is your PHP version ?

Christian.

  3. Re: Just hang and die   Reply   Report abuse  
Picture of Marcel Soler Marcel Soler - 2016-10-23 11:42:26 - In reply to message 2 from Christian Vigh
PHP Version 5.5.6
System Windows NT PC-AURIGA 6.2 build 9200 (Windows 8 Home Premium Edition) i586
Build Date Nov 12 2013 11:29:52
Compiler MSVC11 (Visual C++ 2012)
Architecture x86
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\windows
Loaded Configuration File C:\xampp\php\php.ini

  4. Re: Just hang and die   Reply   Report abuse  
Picture of Christian Vigh Christian Vigh - 2016-10-23 11:56:15 - In reply to message 3 from Marcel Soler
You need PHP >= 5.6 ; this is why you got nothing when testing : the script simply failed with a fatal error, which you cannot catch.

  5. Re: Just hang and die   Reply   Report abuse  
Picture of Floder Hlod Floder Hlod - 2016-12-05 15:20:32 - In reply to message 4 from Christian Vigh
Aha! This is happening to me on some PDFs as well. I'm also using PHP version 5.5 I'll update and try again.

  6. Re: Just hang and die   Reply   Report abuse  
Picture of Christian Vigh Christian Vigh - 2016-12-05 15:32:56 - In reply to message 5 from Floder Hlod
meanwhile, I changed the PdfToText class and made it backward compatible down to version 5.1, so everything should work without needing to upgrade your PHP version ; you just need to download the latest version of the class.

However, if it still fails on certain pdf files, would it be possible to send the failing samples to my address ? (christian.vigh@wuthering-bytes.com).


  7. Re: Just hang and die   Reply   Report abuse  
Picture of Floder Hlod Floder Hlod - 2016-12-07 15:18:56 - In reply to message 6 from Christian Vigh
Ok that's great news, I just upgraded my XAMPP to PHP 7 and the code worked great after that (no hangs), but then I found that my hosting provider (Godaddy) won't let you upgrade PHP past 5.6!

I'll try your updated version and post how it goes on an older version of PHP.

  8. Re: Just hang and die   Reply   Report abuse  
Picture of Floder Hlod Floder Hlod - 2016-12-07 15:55:54 - In reply to message 6 from Christian Vigh
It seems to be working ok on my shared hosting server (php5.5), it just throws a lot of these notices which might be slowing things down as it runs faster on my xampp (php7).
"Trying to get property of non-object in *** on line 3729"

Which is the following line:
$cache = $this -> Fonts [ $font ] -> CharacterMap -> Cache ;

Is this the correct place to download the new version? : https://www.phpclasses.org/browse/file/76212.html

It says the last update was 3 days ago ("Started implementation of CID fonts (EXPERIMENTAL)")

Thanks

  9. Re: Just hang and die   Reply   Report abuse  
Picture of Christian Vigh Christian Vigh - 2016-12-07 20:50:47 - In reply to message 8 from Floder Hlod
Hello Flodler,

yes it works on your hosting server because, starting with version 1.3.4, I made the necessary work so that my PdfToText class is now compatible with PHP >= 5.1.

You downloaded the latest version, which is ok.

You are right : it is slower on your shared hosting server because of all the notice messages.

I have made a fix for that, however I would like to be able to test it before publishing a new version of PdfToText ; could you please send me the PDF file you tested (the one that generates so many notices) at the following address :

christian.vigh@wuthering-bytes.com

Thanks for your help,
Christian.

 
For more information send a message to info at phpclasses dot org.