exec function not working

Discussion in 'PHP' started by learnerabn, Nov 18, 2010.

  1. #1
    Hi all,
    i want to change a word file ordianary text file.
    i used exec("antiword -f -t ".$word_file_path ." > ".$txt_file_path);to do this but not able to get this. and not getting any error in my php.ini file disable_function is also null what shall i do to convert my word file to txt file.
    Please help me as soon as possible.

    Thanks in advance.
     
    learnerabn, Nov 18, 2010 IP
  2. lkboy4u

    lkboy4u Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Most of Web Hosting services disable this function due to security reason. So it may be useless, even if you are able to correct this error. Think twice. Alternative way is generating a XML file for these purpose. Am using it in my site.
     
    lkboy4u, Nov 18, 2010 IP
  3. sponsorlist

    sponsorlist Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you want to test if exec function is working and get some output from it, start with something simple like:
    print exec("echo testing");

    If that doesn't work then there's problem with PHP settings/permissions, if that works then the problem is with your command syntax or antiword program, either way you have to go step by step to locate the problem.
     
    sponsorlist, Nov 18, 2010 IP
  4. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #4
    if (function_exists("exec")) {
    
        // Execute your code
    
    } else {
    
        // Update your php.ini - exec is disabled
    
    }
    PHP:
     
    ActiveFrost, Nov 18, 2010 IP
  5. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you r correct sponsorlist,
    the exec function is working properly how can i test what is the problem in the command -antiword -f -t ".$word_file_path ." > ".$txt_file_path.
    and another thing i'm working in my wamp localhost not in server.

    Thank you.
     
    learnerabn, Nov 18, 2010 IP
  6. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    need install any thing for executing the antiword command? Please any one know means tell me i'm new to the commands.
     
    learnerabn, Nov 18, 2010 IP
  7. sponsorlist

    sponsorlist Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I don't know anything about antiword but you need to have a right version installed(from http://www.winfield.demon.nl/ ) and in some path that can be executed by php exec(). And then figure out how to make it work in command line before trying with PHP. But you can still add print command before exec() in PHP to see if there's some response. Or google for more info http://www.google.com/search?q=antiword+php
     
    sponsorlist, Nov 19, 2010 IP
  8. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thank you.
    i have tried putting print before that exec but no responds.any how its working in live the problem arises only in my localhost so no problem.
     
    learnerabn, Nov 23, 2010 IP