Results 1 to 3 of 3
  1. #1

    PHP exec() problems with Xampplite

    Please excuse my lack of vbCode as I am a new user and can't use that until I have 5 posts. I'm trying to use a PHP script to start a program like I would via command line on my Windows 2003 server which is running PHP and Apache with Xampplite. I am trying the code in two different ways that I have found other people using but the program (webshotcmd.exe) does not run.

    My first code is:
    PHP Code:
    $title str_replace(" ","%20",$title);
    $name $_GET[name];
    $command '/webshotcmd.exe /url "'.$title.'" /out "images/'.$name.'" /width "300" /height "240" /bwidth "768" /bheight "1024"';
    When I run the above it outputs this:
    Array ( ) 1

    Then my second attempt is this which I found on under the exec() documentation:
    PHP Code:
    $path "C:/xampplite/htdocs/WebShot/";
    $exe "webshotcmd.exe";
    $args '/url "'.$title.'" /out "images/'.$name.'" /width "300" /height "240" /bwidth "768" /bheight "1024"'

    PHP Code:
    function execInBackground($path$exe$args "")

        if (
    file_exists($path $exe))
            if (
    substr(php_uname(), 07) == "Windows")
    pclose(popen("start \"bla\" \"" $exe "\" " escapeshellarg($args), "r"));
    exec("./" $exe " " escapeshellarg($args) . " > /dev/null &");
    "File didn't exist";

    The second code does not give me the file didn't exist so I should be referencing the .exe correctly. I have heard there are sometimes permission problems with the exec() function so I have tried setting them but I don't know if I did that correctly. Any help and advice you can offer is greatly appreciated.
    Last edited by dollar; 03-14-2008 at 10:22 PM. Reason: Added BB Code

  2. #2
    Join Date
    Aug 2007
    Can you check in the task manager if the programm is running?
    If apache is installed as a service the programm might by running as SYSTEM and you cannot see its GUI.
    NOT a webhost!helping here just for the fun of it!
    G(r)eek inside.

  3. #3
    Join Date
    Jul 2003
    For your first snippet of code, you need to edit it so that you give the full path to the file 'webshotcmd.exe'. As it is written currently, it is looking for the file from /, which is the root of your web directory. I doubt the file is there.

    Second, since you are running this from Windows, make sure the SYSTEM user has permissions to execute the file. You can check this by going to the file itself, right click, and properties. Then I believe its Security or Permissions...forgot really.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts