Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

running perl in php

Question posted by: ogo796 (Member) on May 8th, 2008 03:27 PM
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's Avatar
gnawz
Member
44 Posts
May 10th, 2008
08:31 AM
#2

Re: running perl in php
Quote:
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.

Reply
dlite922's Avatar
dlite922
Site Addict
562 Posts
May 10th, 2008
08:38 AM
#3

Re: running perl in php
Quote:
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");

Reply
realin's Avatar
realin
Familiar Sight
249 Posts
May 10th, 2008
06:03 PM
#4

Re: running perl in php
i bet shell_exec() should solve the purpose
cheers !!

Reply
Reply
Not the answer you were looking for? Post your question . . .
190,062 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top PHP Forum Contributors