Author |
Message |
brentnhunter
Client

Joined: Sep 10, 2004
Posts: 166
|
Posted:
Thu Oct 28, 2004 7:46 am |
|
Does anyone know the process and syntax for calling a perl script from within a phpnuke page or module? And where the perl script must be located on the server in order for it to be accessible from that page?
Thanks for any help anyone can provide.
Cheers,
Brent Hunter |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Oct 28, 2004 9:59 am |
|
Although it can be called from anywhere, most people put the script in their CGI folder and just call it like any other hyperlink. |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 11:14 am |
|
Raven wrote: | Although it can be called from anywhere, most people put the script in their CGI folder and just call it like any other hyperlink. |
Raven,
Thanks... if I want the output of the perl code to be included as part of the web page, don't I have to include as an SSI or something like that? If so, how would I accomplish that?
Thank you!
Brent |
|
|
|
 |
Raven

|
Posted:
Thu Oct 28, 2004 5:14 pm |
|
I hesitated about answering this, especially because you're on my server
Here would be an exampleCode:<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
|
You execute the command with the backtick operator-> `
Read up on it at http://us2.php.net/manual/en/language.operators.execution.php
Note all the warnings. |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 5:39 pm |
|
Thanks very much. I've read the link you advised, and I'll be very careful using it.
Brent |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 8:28 pm |
|
Gaylen,
I am trying to run a little perl script on one of my web pages that outputs text, and I would like that text to be part of the HTML that is generated as part of that page. I have included the following in one of my phpnuke pages:
$output = `./urlrand.cgi`;
echo "$output";
echo "After CGI call";
Although it prints the first part of the page and the "After CGI call" text, it doesn't output anything when it calls the program.
The first line of my perl script is:
#!/usr/bin/perl
Is that the correct location for perl on your server?
FYI, the php file and the cgi file are both located in the same directory.
Any ideas why it isn't doing anything? And yes, I set the permissions on the urlrand.cgi file to 755 to make it executable.
Thank you for any help you can provide!
Brent
P.S. This isn't the script we discussed this morning, this one performs a different function. |
|
|
|
 |
Raven

|
Posted:
Thu Oct 28, 2004 8:33 pm |
|
The path is correct. Check your error log incPanel to see if there's an error. |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 8:42 pm |
|
Hmmm, what might cause this? I was getting these errors earlier in the day; I only started testing my perl script a while ago so it can't be related to the script:
[Thu Oct 28 12:47:21 2004] [error] [client 167.6.245.98] File does not exist: /home/earthlh/public_html/earthcommcenter/404.shtml
[Thu Oct 28 12:47:21 2004] [error] [client 167.6.245.98] File does not exist: /home/earthlh/public_html/earthcommcenter/transparent
I am also looking at another error that is caused by the script. Something about headers, I'm looking into it now. |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 8:45 pm |
|
OK I got rid of the header error, it was trying to output a header twice. However I am now getting the error I referred to above:
[Thu Oct 28 21:43:19 2004] [error] [client 67.174.196.221] File does not exist: /home/earthlh/public_html/earthcommcenter/404.shtml
[Thu Oct 28 21:43:19 2004] [error] [client 67.174.196.221] File does not exist: /home/earthlh/public_html/earthcommcenter/transparent
Any more recommendations?
Brent |
|
|
|
 |
Raven

|
Posted:
Thu Oct 28, 2004 8:55 pm |
|
The error is just what it says. 2 files are being called that don't exist. Find what scripts are calling them. The 404.shtml is an error script that you can just make up to be displayed when a file is not found. Probably in cPanel you have directed it to that and never put it there. The other appears to be a result of a script that you are running. |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 9:03 pm |
|
I never set anything to do with error pages. I went in to cpanel and only saw what appear to be default setting for a handful of different errors.
These errors were taking place earlier today (in addition to now), when I didn't even have the script loaded onto the server so something else must be generating those errors. I will have to go to various aread of my site, check the error log, and see what is generating the error.
But back to my question on the script, my script doesn't call any of the missing files and I'm still not sure why it isn't working?
Brent |
|
|
|
 |
brentnhunter

|
Posted:
Thu Oct 28, 2004 9:56 pm |
|
|
|
 |
|