Click here to Skip to main content
15,887,435 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi there, my code below show the code just tried to count number of words in ms word (docx,doc format) I succceed on localhost but on remote serve I get this errors

[23-Apr-2017 06:45:12 UTC] PHP Fatal error: Class 'ZipArchive' not found in /home/afyazone/public_html/demo/doclibrary/class.doccounter.php on line 170
[23-Apr-2017 09:11:40 UTC] PHP Notice: Undefined index: email in /home/afyazone/public_html/demo/payment.php on line 9
[23-Apr-2017 10:26:17 UTC] PHP Fatal error: Class 'ZipArchive' not found in /home/afyazone/public_html/demo/doclibrary/class.doccounter.php on line 170
[23-Apr-2017 10:39:35 UTC] PHP Fatal error: Class 'ZipArchive' not found in /home/afyazone/public_html/demo/doclibrary/class.doccounter.php on line 170

I use this library: GitHub - joeblurton/doccounter: A collection of simple tools for analysing PDF, .DOCX, .DOC and .TXT files.[^]

I don't know where im going wrong, please I need help. Thanks

What I have tried:

PHP
require_once("doclibrary/class.doccounter.php");

$countDocx = "";

$sqlCheck = $connect->query("SELECT * FROM temp WHERE email = '".$_SESSION["email"]."' ORDER BY tempid DESC LIMIT 1");

if($sqlCheck->num_rows > 0){
	
	
	while($loops = $sqlCheck->fetch_assoc()){
	
	$countDocx =  $loops["file"];
	
		$_SESSION["docx"] = $loops["file"];
		$_SESSION["title"] = $loops["title"];
	
}

$fileDir = "AuthorReport/".$countDocx;
$doc = new DocCounter();
$doc->setFile("$fileDir");

$words = ($doc->getInfo()->wordCount);

}
Posted
Updated 8-May-17 1:04am
v5
Comments
Richard MacCutchan 23-Apr-17 7:47am    
What is it about the error message "Fatal error: Class 'ZipArchive' not found in /home/afyazone/public_html/demo/doclibrary/class.doccounter.php on line 170" that you do not understand?
Kornfeld Eliyahu Peter 23-Apr-17 8:19am    
http://php.net/manual/en/class.ziparchive.php
Richard MacCutchan 23-Apr-17 8:39am    
??
Kornfeld Eliyahu Peter 23-Apr-17 8:42am    
Shaking hands :-)
divisiblebyzero 23-Apr-17 7:55am    
I don't understand

I check your link and I tested to my local server but it display wrong number of words differ from ms word displayed. Any suggestions guys

My code:
<?php
require_once("includes/library_count_words.php");


$fileDir = "today.docx";

$docObj = new Doc2Txt($fileDir);

$txt = $docObj->convertToText();

$words = str_word_count($txt);

print $words;

?>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900