Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

More of a server question really

by October (Initiate)
on Aug 22, 2001 at 04:52 UTC ( #106841=perlquestion: print w/replies, xml ) Need Help??

October has asked for the wisdom of the Perl Monks concerning the following question:

I just moved my site to a new server, and my perl scripts have stopped functioning. I changed the #! line appropriately, and the scripts run perfectly from the command line. However, accessing them from a browser just prints out the code. Any ideas on what I can try to fix this? Thanks for any help.

Replies are listed 'Best First'.
Re: More of a server question really
by Jerry (Scribe) on Aug 22, 2001 at 07:39 UTC
    If you're running apache, you can add ExecCGI to the Directory declaration (for the whole web server structure, or on a per-directory basis), and also make sure you AddHandler for .cgi and .pl files.
    might just have the answers you need.


Re: More of a server question really
by ozone (Friar) on Aug 22, 2001 at 05:03 UTC

    Your webserver needs to be configured to execute the scripts... You would probably find the necessary lines by doing a quick diff between the config files (old machine/new machine)

Re: More of a server question really
by bikeNomad (Priest) on Aug 22, 2001 at 05:01 UTC
    Are they marked as executable? Is your server prepared to execute programs in the places you put them and with the names you gave them? There is some server configuration that may be required.

    Look at CGI Help Guide.

      All the scripts are 'chmod'ed to 755, and they're in the cgi-bin directory, which seems to be where the other hosted sites on the server store their perl scripts, and I've tried both .cgi and .pl extensions. (other sites are using .pl with no problems, but I figured I'd check both)
Re: More of a server question really
by earthboundmisfit (Chaplain) on Aug 22, 2001 at 18:12 UTC
    I'm not sure if you are using an ISP or not, but it's possible that the administrators have a policy of checking all programs before allowing them to run. The how and why of this varies, but I've encountered ISPs who place a red herring cgi-bin within the user's root web directory. The directory does not have execute permissions. Once admin has approved the program, they replace the file with a sym link to a copy that has been moved to the real cgi-bin.

    That said, you are using and printing the header(), right?

Re: More of a server question really
by MZSanford (Curate) on Aug 22, 2001 at 18:18 UTC
        Just incase the above do not help, think about what changes between the command line and the browser ... many times it is the user/environment. If you are using su to run the script as the webserver user, make sure you use su - username to get the correct environment. This is usually only an issue if the script is opening other files (modules, passwd files, cfg, etc...). Just a thought.

    can't sleep clowns will eat me
    -- MZSanford
Re: More of a server question really
by October (Initiate) on Aug 23, 2001 at 11:45 UTC
    Well, I've managed to get a temporary fix in place. The site is running on a server run by a friend of mine, so I don't have root acces, but he's willing to configure just about anything I want. For the moment, he just moved my scripts over to the working cgi-bin directory, and he's going to go through his config files and fix what needs to be fixed. Thanks for all the help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://106841]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2021-05-15 12:20 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (150 votes). Check out past polls.