+ Reply to Thread
Results 1 to 8 of 8

Thread: Run exe file from php script

  1. #1
    sumitmehta is offline x10 Sophmore sumitmehta is an unknown quantity at this point
    Join Date
    Oct 2005
    Posts
    106

    Run exe file from php script

    Sometimes it is necessary to execute exe files from a php script Below is the code used for that.

    <?php
    $data = array(); // define array

    exec('dir', $data, $ret); // execute command, output is array

    echo "<pre>";
    if ($ret == 0) { // check status code. if successful
    foreach ($data as $line) { // process array line by line
    echo "$line \n";
    }
    } else {
    echo "Error in command"; // if unsuccessful display error
    }
    echo "</pre>";
    ?>

  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: Run exe file from php script

    sweet...now I can fine tune to to possibly run ffmpeg.exe

  3. #3
    kajasweb's Avatar
    kajasweb is offline Lord Of The Keys kajasweb is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    Chennai, India
    Posts
    1,722

    Re: Run exe file from php script

    exec() function is blocked, by most of the free web hosts.
    R. Kaja Mohideen
    Start Your Own Blog... Start Making Money...
    http://www.MyiStop.com/
    CuteCom.Net - Low Cost International Internet Telephony (VoIP) Service

  4. #4
    satheesh's Avatar
    satheesh is offline x10 Elder satheesh is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Tamil Nadu,India
    Posts
    883

    Re: Run exe file from php script

    Nice tutorial.
    I want to buy Some Scripts So Please Click This link:http://affiliate.tufat.com/index.php?id=4384
    Please rate my site:Click here




  5. #5
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: Run exe file from php script

    Its a wonderful tutorial.......
    But as kajasweb told, the exec() function is disabled in most of the host.
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  6. #6
    sumitmehta is offline x10 Sophmore sumitmehta is an unknown quantity at this point
    Join Date
    Oct 2005
    Posts
    106

    Re: Run exe file from php script

    I am sorry guys. I didn't know about it. But thanks for telling me and getting me updated.

  7. #7
    rayxzero is offline x10Hosting Member rayxzero is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    7

    Re: Run exe file from php script

    Mostly why they blocked exec is because of security. Just like java in order to run applet you need to signed all of your jar files.

  8. #8
    sumitmehta is offline x10 Sophmore sumitmehta is an unknown quantity at this point
    Join Date
    Oct 2005
    Posts
    106

    Re: Run exe file from php script

    Ya I understand all those issues. EXE files are always dangerous for servers. It was just a matter of fact that it didn't click my mind that free servers won't be allowing it as my scripts never use exec() functions and so I have never tried it.

+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. CRON Jobs and PHP
    By deadimp in forum Tutorials
    Replies: 14
    Last Post: 11-27-2008, 05:09 PM
  3. Error when running PHP script
    By ipodally in forum Free Hosting
    Replies: 2
    Last Post: 01-28-2008, 09:02 PM
  4. PHP script denied from calling ImageMagick
    By beegdaddy in forum Free Hosting
    Replies: 2
    Last Post: 11-17-2007, 11:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers