php exec();

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

    #1

    php exec();

    hi,

    i've been trying to create a php script that writes some text to a
    file, then runs the perl interpreter on the file and shows the output.
    it works ok when valid perl is written to the file, so if i use 'print
    "hello world";' then it outputs 'hello world'. the problem is, if i
    enter invalid perl code, such as 'blahblahblah;' , it outputs nothing.
    i'd like the php script to be able to get the error/output. does anyone
    know of a way to do this?

    thanks in advance.

  • theCancerus

    #2
    Re: php exec();


    hi SAM,

    i think you should use shell_exec function.
    it Execute command via shell and return complete output as string

    or you can also try proc_open -- Execute a command and open file
    pointers for input/output

    regards
    Amit


    On Dec 11, 5:38 am, "Sam" <samkl...@gmail .comwrote:
    hi,
    >
    i've been trying to create a php script that writes some text to a
    file, then runs the perl interpreter on the file and shows the output.
    it works ok when valid perl is written to the file, so if i use 'print
    "hello world";' then it outputs 'hello world'. the problem is, if i
    enter invalid perl code, such as 'blahblahblah;' , it outputs nothing.
    i'd like the php script to be able to get the error/output. does anyone
    know of a way to do this?
    >
    thanks in advance.

    Comment

    Working...