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

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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.