Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Running an executable under php ?

    Hello all.

    I am using a program called jhead.exe.

    It cleans up the headers from a jpg image file.

    Does anyone use it ?

    Is this the correct method to call the program ?:

    PHP Code:
    exec("jhead -purejpg ".$source); // cleans up jpg headers 
    The jhead.exe file is in the same directory ans all my php scripts so I am not sure if I need to put a path in the statement or not.

    Anyone with experience of this ?

    Thanks.
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    Regular Coder
    Join Date
    Sep 2006
    Location
    Vermont, USA
    Posts
    154
    Thanks
    0
    Thanked 6 Times in 6 Posts
    My guess would be fully path.
    Active PHP/MySQL application developer available for immediate work.
    syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Quote Originally Posted by "PHP.NET
    Trying to us the following code failed badly with various results: like "unable to fork", "access denied", "empty results", depending on what settings I used, ... even though the same code worked from command line on the server itself.

    $retstr = exec('nslookup -type=mx myhost.com', $retarr);

    Instead of nslookup I believe this would apply to most programs from the \system32\ directory.

    I had to learn that the following finally worked:
    $retstr = exec('c:\php\safedir\nslookup -type=mx myhost.com', $retarr);

    ... but only under the listed preconditions:
    1: nslookup.exe is placed (copied) in the directory \php\safedir\
    2: the directory \php\safedir\ is included in the system PATH environement variable
    3: the file cmd.exe is placed in \php\ as listed by other notes above
    4: the directory "c:\php\safedir\" is set in the php.ini setting
    safe_mode_exec_dir = "c:\php\safedir\"
    .. maybe set in php-activescript.ini as well, depending on your system setup.
    5: nslookup is referenced by the full path as otherwise the file from \windows\system32\ will be called. This happend to me with empty result due to missing rights!

    Hope this helps somebody saving some time and headaches.
    Thomas
    hope this helps

  • #4
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    That is VERY interesting - thanks for posting it.

    Looks like I have a bit of work to do
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.


  •  

    Posting Permissions

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