954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Invoking Perl from php page

I am trying to run the following perlscript from php page. But unfortunately, it failed without giving any error.

exec("PERL C:/Program Files/Zend/Apache2/htdocs/Scripts/test.pl");

But when I am trying the same perl command from command line interface, it runs successfully.

PERL C:/Program Files/Zend/Apache2/htdocs/Scripts/test.pl

Can anybody advise, where i am making mistake? I need to invoke the same perl command from php. Thanks in advance!!


Content of test.pl

#!/usr/bin/perl
print "Hello World!\n";

Regards,
Deepali

Deepali_Jain
Newbie Poster
6 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Are you sure it failed?
When you're using exec like in your post, it won't output anything but only return the last line of the result of the given command.

If you want all the output supply an array as second argument to exec. This array will then be filled with each line of the output of the given command:

exec("PERL C:/Program Files/Zend/Apache2/htdocs/Scripts/test.pl", $result);
print_r($result);
Insensus
Junior Poster
112 posts since Mar 2011
Reputation Points: 70
Solved Threads: 46
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: