running perl in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ogo796
    New Member
    • Jan 2008
    • 44

    running perl in php

    hi everyone

    i am running ubuntu and all my scripts are in php,i have a program
    written in C and Perl that do a specic job in my site.so my problem is i can't run that specific program while i am out site the directory.

    can someone help me with a php code that can run the program that is out site the current working directory.i use the following code but nothing happend.

    $output=exec(/home/data/test make.pl )
    shell_exec("cd /home/data/test make.pl ");

    make.pl is the script that i want to run.
  • gnawz
    New Member
    • Nov 2006
    • 64

    #2
    Originally posted by ogo796
    hi everyone

    i am running ubuntu and all my scripts are in php,i have a program
    written in C and Perl that do a specic job in my site.so my problem is i can't run that specific program while i am out site the directory.

    can someone help me with a php code that can run the program that is out site the current working directory.i use the following code but nothing happend.

    $output=exec(/home/data/test make.pl )
    shell_exec("cd /home/data/test make.pl ");

    make.pl is the script that i want to run.
    Why do you run the program outside the directory?It is just a series of code and I bet you want all your code to be executed!
    Put it in the same directory and then run a shell script.

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      Originally posted by ogo796
      hi everyone

      i am running ubuntu and all my scripts are in php,i have a program
      written in C and Perl that do a specic job in my site.so my problem is i can't run that specific program while i am out site the directory.

      can someone help me with a php code that can run the program that is out site the current working directory.i use the following code but nothing happend.

      $output=exec(/home/data/test make.pl )
      shell_exec("cd /home/data/test make.pl ");

      make.pl is the script that i want to run.
      shell_exec() should work.

      Yours doesn't because, CD is a command and MAKE is a command.

      did you try this

      shell_exec("/home/data/test/make.pl");

      Comment

      • realin
        Contributor
        • Feb 2007
        • 254

        #4
        i bet shell_exec() should solve the purpose
        cheers !!

        Comment

        Working...