Skip to main content
Inspiring
December 6, 2007
Question

CFEXECUTE to run a Perl script not returning anything

  • December 6, 2007
  • 3 replies
  • 3837 views
I'm trying something like:
<CFEXECUTE NAME="/var/www/cgi-bin/something.pl" TIMEOUT="60"/>
but there is no output. This works from the command line and from the browser (running CFHTTP is not a great substitute here).

I've read on the forums that this could be a permission issue, but I'm not getting an error. The documentation for CFEXECUTE says "If the effective user of the ColdFusion executing thread does not have permissions to execute the process: a security exception." So why no exception? FYI, I'm running ColdFusion 7 on Linux.

I know that CFEXECUTE by itself works because this tag works and returns the date/time: <CFEXECUTE NAME="date" TIMEOUT="60"/>

If ColdFusion does need to have different permissions and/or run as a different user in order to run a Perl script, how do you set this up? And is this a big security issue if it's on a public web server?

Thanks for any input.
This topic has been closed for replies.

3 replies

Inspiring
December 17, 2007
Is the CF service running under the system account? And does the system account have execute access to the Perl exe? Are there any credentials required to execute the Perl script? Even if not, is there any way to pass credentials as an argument?

I had a similar problem a while back that drove me mad for days, related to attempting to execute svn.exe with various parameters. The cleanup and info actions worked fine, but the update action would fail (and hang the cmd.exe process). Turns out I found a command line switch to explicitly pass along my svn credentials, and that did the trick.

Have you successfully CFExecuted ANY Perl script? If you try one that simply echoes a hello, does that work?
Known Participant
January 4, 2020

Hi,

The perl script runs fine from the command line but when I execute the same perl script using the coldfusion cfexecute it fails to run.

 

It cannot find the methods/functions used in the perl script like SelectAllEditableRanges, Bookmarks, InsertAfter. The script fails whereever this functions are called in the perl script.

 

How do I run the perl script using cfexecute.

 

Thanks.

Charlie Arehart
Community Expert
Community Expert
January 5, 2020

Show us what you're using for the cfexecute attributes, and the command you use at the command line. 

 

Also, I'm not sure it's wise to just drop a reply into a 12 year old thread like this. It's possible the previous participants either are no longer involved, not able to help, or may even not want to hear from us (if they're setup to receive amail notifications of replies in this thread). 

/Charlie (troubleshooter, carehart. org)
Inspiring
December 17, 2007
Any other ideas?
December 7, 2007
Grant,

I've executed perl on a Windows server by putting the perl executable itself as the name, and the script name as the first argument. May or may not address your issue, but could be worth a try...

James

<cfexecute name="C:\Perl\bin\perl.exe" timeout="60"
arguments="#ExpandPath('script.pl')# #otherArgs#"/>
Inspiring
December 7, 2007
Thanks, but that didn't work either. It seems to recognize the path to Perl (/usr/bin/perl, for example) because if I put in an invalid path, it gives an error ("java.io.IOException: /usr/bin/perlssss: not found").

However, if I put in a script name that doesn't exist:
<CFEXECUTE NAME="/usr/bin/perl" ARGUMENTS="doesntexist.pl" TIMEOUT="60"/>
I don't get an error. It's just not attempting to execute anything.
December 7, 2007
Grant,

What happens if you give a full pathname to the script? In your example, you just had doesntexist.pl without a full path.

Seems like perl is running, but it might be outputting an error to stderr. Does CFEXECUTE capture stderr output, or only stdout? (I don't know offhand.)

James