executing programs on a server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    executing programs on a server

    hi,

    i've written a c++ program that converts one file type to another via
    two arguments (the input and output filenames).

    i want to execute this on my server, using something like

    exec("myprogram .exe $arg1 $arg2");

    but then I realized my server is linux, and my program was compiled for
    windows.

    so I uploaded the .cpp instead, and now i'm trying to compile it doing
    something like

    exec("gccp hello.cpp");

    which returns an exit code 127... not really sure what that means.

    I'm guessing I probably don't have permission to be creating files on
    my server...is there anyway I can change this permissions or anything?

    (or what group should I be posting this in??)

  • Andy Hassall

    #2
    Re: executing programs on a server

    On 10 Oct 2006 14:43:41 -0700, "Mark" <mnbayazit@gmai l.comwrote:
    >i've written a c++ program that converts one file type to another via
    >two arguments (the input and output filenames).
    >
    >i want to execute this on my server, using something like
    >
    >exec("myprogra m.exe $arg1 $arg2");
    >
    >but then I realized my server is linux, and my program was compiled for
    >windows.
    >
    >so I uploaded the .cpp instead, and now i'm trying to compile it doing
    >something like
    >
    >exec("gccp hello.cpp");
    >
    >which returns an exit code 127... not really sure what that means.
    What is gccp? Did you mean gcc (or g++)? 127 is (usually) "command not found".

    There's more options you'll need to pass as well - at least "-o" to specify
    the name of the final executable (else it'll come out as "a.out" for historical
    reasons).
    >I'm guessing I probably don't have permission to be creating files on
    >my server...is there anyway I can change this permissions or anything?
    Trying to compile code by executing shell commands through PHP is going to be
    a total nightmare. It can be done but it's an incredibly awkward way to work.

    Do you not have a shell login to the server, so you can run commands normally?
    >(or what group should I be posting this in??)
    A general Linux group most likely - comp.os.linux.m isc ?

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Mark

      #3
      Re: executing programs on a server


      Andy Hassall wrote:
      On 10 Oct 2006 14:43:41 -0700, "Mark" <mnbayazit@gmai l.comwrote:
      >
      i've written a c++ program that converts one file type to another via
      two arguments (the input and output filenames).

      i want to execute this on my server, using something like

      exec("myprogram .exe $arg1 $arg2");

      but then I realized my server is linux, and my program was compiled for
      windows.

      so I uploaded the .cpp instead, and now i'm trying to compile it doing
      something like

      exec("gccp hello.cpp");

      which returns an exit code 127... not really sure what that means.
      >
      What is gccp? Did you mean gcc (or g++)? 127 is (usually) "command not found".
      >
      There's more options you'll need to pass as well - at least "-o" to specify
      the name of the final executable (else it'll come out as "a.out" for historical
      reasons).
      >
      I'm guessing I probably don't have permission to be creating files on
      my server...is there anyway I can change this permissions or anything?
      >
      Trying to compile code by executing shell commands through PHP is going to be
      a total nightmare. It can be done but it's an incredibly awkward way to work.
      >
      Do you not have a shell login to the server, so you can run commands normally?
      >
      (or what group should I be posting this in??)
      >
      A general Linux group most likely - comp.os.linux.m isc ?
      >
      --
      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
      err.. found gccp on some linux tutorial site. it's supposed to create
      "a.out"

      it seems to return 1 if the command doesn't exist. i'll go snoop around
      the linux group you suggested. thanks.

      Comment

      Working...