Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 159
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 135
Total: 135

Author Topic: Extreme coding help  (Read 4859 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Extreme coding help
« on: March 21, 2017, 05:49:30 pm »
I'm trying to execute a program that converts documents into plain text.

http://silvercoders.com/en/products/doctotext/

I've tried contacting the developer, but offers no help. My test server is on my Windows PC:

I would like to run the program in PHP. Here's what I have so far

Code: [Select]
<?php

$location 
'C:\\xampp\\htdocs\\test_doc.docx';

$output exec("C:\\doctotext\\doctotext.exe /c $location");

echo 
'The output: '.$output;

?>

Could someone steer me in the right direction? There are absolutely no examples on the internet using this free, powerful program.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #1 on: March 21, 2017, 07:57:29 pm »
You have to make sure the webserver has permission to execute the program doctotext.exe
You should give Apache access to that whole folder.

I would do this as well
$location = '"C:\\xampp\\htdocs\\test_doc.docx"';
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #2 on: March 21, 2017, 11:18:05 pm »
I'm using XAMPP. Not sure how to do what you recommended. I wish I could get someone to try this out on their server, really stuck.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #3 on: March 22, 2017, 12:41:46 pm »
Good news, I got it working on my Windows based server:

Code: [Select]
<?php 

$file 
'C:\xampp\htdocs\SMF\sdsdssss.docx';

$content exec'C:\xampp\htdocs\SMF\doctotext\doctotext.exe /c '$file $output );

echo 
'output of the file after read by doctotex.exe: ' ;
echo 
nl2br("\n");
print_r$output );

echo 
nl2br("\n");

$string '';

foreach ( 
$output as $o ) {
    
$string .= $o;
}

echo 
nl2br("\n");

However, how would I get this to work on my Centos server? Obviously I'd have to download the Linux version of the software, but how do the codes change?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #4 on: March 22, 2017, 12:49:29 pm »
It would be a different path to binary file.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #5 on: March 22, 2017, 12:55:44 pm »
Please advice, I placed doctotext into:

Code: [Select]
/home/***/public_html/doctotext
and the file:

Code: [Select]
/home/***/public_html/downloads/test_doc.docx

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #6 on: March 22, 2017, 12:57:47 pm »
That would do it.
You would need to check the file permissions on doctext maybe try giving it 777
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #7 on: March 22, 2017, 01:01:43 pm »
That would do it.
You would need to check the file permissions on doctext maybe try giving it 777

On the folder or the file itself? Should I do it recursively so that everything inside gets 777?

Code: [Select]
$file = '/home/***/public_html/downloads/test_doc.docx';

$content = exec( '/home/***/public_html/doctotext/doctotext \c '. $file , $output );

This didn't work...
« Last Edit: March 22, 2017, 01:05:02 pm by shuban »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #8 on: March 22, 2017, 01:14:39 pm »
Make sure it is part of the same user group as apache/webserver
Also make sure the file has excute permissions.

The program for sure. Maybe the whole directory if it is saving information to that folder.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #9 on: March 22, 2017, 01:25:11 pm »
The owner and group is both root.

I tried making everything 777, didn't help.

How would I check logs for this? Do logs even exist?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #10 on: March 22, 2017, 01:31:43 pm »
You could see if $content contains anything that is returned.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #11 on: March 22, 2017, 05:27:54 pm »
I checked and it doesn't return anything unforunately

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #12 on: March 22, 2017, 11:42:44 pm »
The command is wrong. The fact I'm using /c means it's incorrect.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Extreme coding help
« Reply #13 on: March 23, 2017, 02:11:33 pm »
Do you have any other suggestions?

I asked this on Stack overflow, and got this response: http://stackoverflow.com/questions/42967583/executing-a-linux-program-from-php/42970170?noredirect=1#comment73058411_42970170

I think I'm running out of ideas

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Extreme coding help
« Reply #14 on: March 23, 2017, 08:37:58 pm »
Not really stackoverflow is a good place though those people who reply to questions are experts.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
12338 Views
Last post February 07, 2007, 11:04:17 am
by bopla
0 Replies
3043 Views
Last post May 30, 2009, 12:58:57 pm
by menew
1 Replies
3596 Views
Last post November 14, 2009, 07:55:22 pm
by SMFHacks
21 Replies
11132 Views
Last post December 05, 2012, 08:29:05 pm
by SMFHacks
0 Replies
3801 Views
Last post August 06, 2016, 01:43:18 am
by shuban

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal