PDA

View Full Version : Perl CGI Script



northcp9
07-12-2009, 03:48 PM
I have a simple script for an automated site map that I was running on a different server. I can't seem to get it running on hostmonster as I'm new to the server and don't understand the file path names yet and I'm almost positive this is where the problem lies. Here is the code snippet from the pl file, I need to know if the baseurl path is correct and if not what the baseurl path would be or how to determine it:

$conf::basedir_cgi = "/home6/mypassword/public_html";

$conf::baseurl = "/my password/";

On the other server I was on my user name served as the base url as it was actually part of the url address (not the server url) so I thought it might work here. No luck I've tried my url address and every combination I can think of with no luck. The URL for the "unfinished" site is http://northcoastcreatives.com

Roger Hatfield

mmonsen
07-12-2009, 09:31 PM
The $conf::basedir_cgi should be set to something like the following:



$conf::basedir_cgi = "/home(#)/(username)/public_html";


Where the (#) is the number of your home directory and the (username) is your 8 character username. If you have SSH access you can just run the command "pwd" to get the correct working directory.

As for the $conf::baseurl, this would be based on if you had your script running from a sub directory of your main domain. If you had put your script in the folder "password" then it would be set up like:



$conf::baseurl = "/password/";


If the script is run from the root of your domain then it would look like:



$conf::baseurl = "/";

northcp9
07-13-2009, 02:23 AM
Hi mmonsen,

I didn't lay things out very clearly. In my public_html folder I have an index.php file that is the home page for my site. Also in the public_html folder is another file called sitemap.php (one of the pages on my site) that has this snippet of code in it that calls tree.pl file:

<?php
virtual("cgi-bin/tree/tree.pl");
?>

The cgi-bin folder is in my public_html folder also obviously.
You can see the local path-tree.pl file inside of tree folder inside cgi-bin folder. The script asks for the absolute paths or root paths (I guess thats the correct term) to the server (I think-I'm not sure how it works-I believe that's right). Here is the code snippets in question:

$conf::basedir_cgi = "/home6/user name/public_html"; I think this one is right.

Here is the one I'm not sure of:

$conf::baseurl = "/http://www.northcoastcreatives.com/"; I put my website url within the forward slashes thinking this is what is meant by baseurl.

I know the baseurl needs to be within the forward slashes and the basedir_cgi just starts with a slash doesn't end with one.

Anyway, that's as clear as I can explain it. If you wanted to take the time you can go to http://www.northcoastcreatives.com then click on the link at the top named sitemap and you can see the error.

Thanks for taking time to try and help. Oh, I forgot-in my original post I have password in the path but I meant username. That may have been confusing to you.

atoms
07-13-2009, 03:44 PM
When I load your sitemap page I see this error:

Fatal error: Call to undefined function virtual() in /home6/northcp9/public_html/sitemap.php on line 44

which appears to be a PHP problem. virtual() is a PHP built-in function, so it seems pretty odd that we'd see this error. Is that the same error you see?

Can you try to call virtual on something very simple, such as an image* in the same directory as the sitemap.php file so we can see what happens then?

*I have not used virtual() myself so perhaps one can't use it in this way?

northcp9
07-14-2009, 09:41 PM
Hi atoms,

Thanks for your input. Yes, this is the same error I see. That is why I have been trying to make sure I have the file paths correct. If my memory serves me correctly when I first configured this script on another server I had to play around getting the file paths correct and when I did get them correct the script worked and I quit getting this error.

Tech help and support finally got back to me with an answer. They tell me this:
"The virtual() function will not work in our PHP version since we don't have PHP installed as a Apache Module".

I don't understand what this means except the script won't work on hostmonsters server. I'm waiting for them to get back to me and tell me how to pick a script that will work. I'm new to hostmonster so I'm going to go to the cpanel and see if I can find some options there.

northcp9

northcp9
07-18-2009, 09:12 AM
First of all to call up the script from your html file use this:

system("file/path/tree.pl"); instead of this: virtual("file/path/tree.pl");

For the "baseurl" path it goes like this: $conf::baseurl = "/"; instead of this:

$conf::baseurl = "/http://www.your_domain.com/";

northcp9