Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Please Save Me From Insanity!!!

by bennierounder (Sexton)
on Feb 08, 2018 at 23:17 UTC ( #1208763=perlquestion: print w/replies, xml ) Need Help??
bennierounder has asked for the wisdom of the Perl Monks concerning the following question:

Sorry its a long post guys, but this is my situation. I'm trying to upload a perlscript onto hostgator access server and they are telling me I need a .php file to execute this code.

Can anyone help at all?

HostGator Support The agent has requested for your authentication before they are able to assist you further with your request.

i want to upload and execute a perl file

Nicolas Bryan joined Thank you for contacting live support. My name is Bryan. How may I assist you?

hi bryan am I able to execute a perl file on a subdomain?

Yes that is executable on a sub-domain.

how do I do it please i want to execute the following code

#!/usr/local/bin/perl use strict; print "Content-type: text/html\n\n"; print "<H1>Hello World</H1>\n";

i have created a subdomain is there anything else i need to do to make it go live

Just to clarify. When were you able to create the sub-domain?

earlier about 4 hours ago

I see your pathing appears to be correct #!/usr/bin/perl based on this but could you please allow the sub-domain to propagate(update)?

how long will that take?

Please give it 24 hours after you set the sub-domain.

I'm having same problem with my normal domain protechflooring.co,uk i have uploaded a file index.html and it wont display on the site why won't it execute

Give me a moment to check it out. But can I verify the account first? Please use the incoming pop-up to input the same credentials you use at portal.hostgator.com. CONFIRMED SIGN IN INFO Thanks for verifying the account. Is it okay if check out your file manager?

yes do whatever you think is necessary please help I have spent 5 hours and still nothing i just want to execute a simple prescript so i can start developing it further, but i know nothing about servers, just know the language are you there ?

I'm checking out the folders now. But some folders are missing. protechflooring.co.uk's folder appears to be missing.

yes i thought that ! plus the other folders aren't responding at all its driving me insane!

The reason on why http://protechflooring.co.uk/ is showing this error

Index of / cgi-bin/ Apache Server at protechflooring.co.uk Port 80

is bcause the folder may have possibly been deleted or it's missing essential files. Did you make any recent changes on the folder of protechflooring.co.uk?

never done anything to it i get same error for all sites unless i use wordpress but i need to use perl now And I've noticed the file uploaded under name quotemyfloor.protechflooring.co.uk is index.html.html. I've renamed it and i appears to be resolving when I load quotemyfloor.protechflooring.co.uk its working now

Can you please try to clear the cache of the browser and attempt to load it again?

i will try and upload the perl file

Alright please do. As long as the path is followed as #!/usr/bin/perl there should be no issues.

#!/usr/local/bin/perl use strict; print "Content-type: text/html\n\n"; print "<H1>Hello World</H1>\n";

i uploaded it to cgi bin is that right? hello world text displaying on the text no hello world text displaying on the site should i change permissions to 0755

Please give me a moment to check it out.

no hello world and I've got permission set to 0755 and uploaded perl script to the server in CGI bin

An index.php file needs to be uploaded along with the respective perl script in order for it to resolve.

what needs to be in the file? the php file? is a blank file ok?

will that do, if so I'll create the file and upload now!

<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>

Does it need to be next to the html file or in the cgi-bin or do I need to create a new folder for php?

Unfortunately we cannot determine for certain here what would be inside the index.php and it needs to be within the cgi-bin.

that's fine I will just put that, its just basic php. php and perl aren't the same anyway so i'm a bit confused why its like this, but I'll give it a go now. does the php needs specific permissions to execute?

The permissions would be 755.

done still only displaying the text from the HTML file I'm afraid no error messages, but nothing displayed i cant tell if its executing or not perl_script.pl file contains the following

#!/usr/local/bin/perl use strict; print "Content-type: text/html\n\n"; print "<H1>Hello World From the Perl File</H1>\n";

Index.php is displaying the following

html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World From the PHP File</p>'; ?> </body> </html>

And index.html is displaying

<html>Hello There I am the html file</html>

only output I'm seeing on the screen is from the html file surely I should be seeing Hello World From the perl file and hello world from the php file as well??? its driving me nuts this

We cannot really determine on what the particular content of the index.php file needs in order execute the perl file from our end as this is more of a web development side of your domain. As much as I wanted to help you out on this, we can't. For we are only covering the technical hosting problems of your domain this particular problem of yours is way beyond our reach. Hello, just checking in with you. Are you still with me?

PHP is nothing to do with perl perl executes code by itself i shouldn't need php to execute it like if i was programming with java, i wouldn't need php its something to do with the server. the apache config file is probably not set right or something that perl script should execute

The php file would allow the perl file to be read and executed.

so can I not execute a perl file on your server with out finding a way how to get php to do it for me. bearing in mind the php file isn't executing anyway! i shouldn't need php for perl i haven't needed it before there must be a way to do this at your end? I'm confused

The reason on why the php file cannot read or execute the perl is because the respective php file needs to be configured specifically for the perl file in question. But we cannot determine the specific configurations for it in order to be executed. As for the configurations we cannot determine which are the correct values from our end. I strongly suggest that you should contact a professional web developer regarding this matter for they are the ones who can help you with this all the way.

I think its a server issue already i should not need php to run perl. it can be set up in the apache config file to accept perl code. you have access to the apache config file as I rent the server from you I may be wrong is there nothing you can do to help?

Thank you for contacting HostGator support.

2018-02-18 Athanasius added code and paragraph tags

Replies are listed 'Best First'.
Re: Please Save Me From Insanity!!!
by roboticus (Chancellor) on Feb 09, 2018 at 00:49 UTC

    bennierounder:

    I'm not a web developer, so I'll grasp at a few straws.

    Things I've tried:

    • I pointed my browser at "http://protechflooring.co.uk" and got an "Index of /" page listing cgi-bin as the only entry. It looks like what I'd expect to see when Apache is serving up a directory without an index.html file.
    • I tried clicking the cgi-bin directory and got the (expected) "403: Forbidden" page.
    • I notice that you mentioned that a script was named "perl_script.pl", so I tried going to http://protechflooring.co.uk/cgi-bin/perl_script.pl, at which point it gave me a "500: Internal Error" page.
    • Finally, I entered http://protechflooring.co.uk/cgi-bin/boink.pl, as I doubt that you have a file named boink.pl in there, and got a "404: Page Not Found" error.

    From that, it appears to me that you need an "index.html" page. I'd suggest trying something trivial like:

    <html> <head> <title>CHEESY INDEX PAGE</title></head> <body> And here's a link to <a href="http://protechflooring.co.uk/cgi-bin/boink.pl">a page that +doesn't exist</a> as well as a link to <a href="http://protechflooring.co.uk/cgi-bin/perl_script.pl">the sc +ript you have</a> </body> </html>

    Since you're getting a 500 error on the perl script, either the web server is misconfigured somehow, or the script is encountering an error while running. So let's try putting a totally simple perl script there to see if it will work. So we want the simplest possible thing. Perhaps just printing something, and nothing else, like this:

    #!/usr/bin/perl print "Content-type: text/html\n\n"; print "NOTHING TO SEE HERE!\n";

    I used the path /usr/bin/perl, as it looks like it should be either that or /usr/local/bin/perl depending on how I should interpret the dialog near the beginning.

    So if it were me, I'd upload the index.html page and the script above into cgi-bin as boink.pl. Then I'd try to hit http://protechflooring.co.uk.

    I'd hope it would show the cheesy index page. If so, that's one problem down. I'd then try to hit http://protechflooring.co.uk/cgi-bin/boink.pl (or just press the link, if the index.html page works properly) and see if we still get a 500 error or not. We it works and we get a blank (or "NOTHING TO SEE HERE"), then it would indicate a problem somewhere in perl_script.pl. If we still get a 500 error, then I'd try changing the script to use the other path and try again.

    Do you have shell access to the machine you're uploading to?

    I'll monitor this thread for a while and see how far you're getting.

    Update: after reading huck's link to hostgator support, I struck out some irrelevent stuff.

    Update: Added the content-type bit. Thanks to tangent for pointing it out!

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Should be:
      #!/usr/bin/perl print "Content-type: text/html\n\n"; print "NOTHING TO SEE HERE!\n";
      If you don't print the header you will get the '500 Internal Server Error'

      Also, what Hostgator support are saying about the PHP file is rubbish, but if you do want to test it then put just this in your index.php:

      <?php echo '<p>Hello World From the PHP File</p>'; ?>
      The first line of the PHP must contain <?php ...

      You're a legend m8! All Done and sorted. Now its time for some coding

      I'm going to try this now, thank you for this help. Just so you know I'm trialling it on sub domain http://quotemyfloor.protechflooring.co.uk

Re: Please Save Me From Insanity!!!
by huck (Vicar) on Feb 09, 2018 at 00:44 UTC

    Two things via http://support.hostgator.com/articles/specialized-help/cgi-troubleshooting

    First what did you set to 755? the file, the directory? BOTH? it has to be BOTH at 755. Setting the directory permissions to 755 should always be sufficient. If you do set any directories to rwxrwxrwx, then any Perl scripts located inside of this directory will not execute!

    Second you show #!/usr/local/bin/perl The first line of your program needs to be the correct path to where perl is installed on your server. On all servers, this path is correct:
    #!/usr/bin/perl

      On all servers, this path is correct:
      #!/usr/bin/perl

      I see you want to help and think that is great, unfortunately that statement is off.
      #!/usr/bin/perl would be a nice passpartout to find perl on all unixish computers,
      but alas you cannot rely on it.

      Cheers, Sören

      Créateur des bugs mobiles - let loose once, run everywhere.
      (hooked on the Perl Programming language)

        Happy-the-monk, huck was quoting (hence the URL and italics) from the "Incorrect Path to PERL" section of the linked hostgator support page. Given that hostgator claims all their servers use that specific perl path, I believe bennierounder could rely on that fact on the hostgator-based website being discussed in this thread. In general, you cannot rely on that, but on hostgator, you should be able to (until they change their setup and documentation).

Re: Please Save Me From Insanity!!!
by poj (Monsignor) on Feb 09, 2018 at 08:37 UTC

    Using the cPanel Control Panel you should have access to the Error Logs. Look at what messages you have there.

    poj

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1208763]
Approved by beech
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (16)
As of 2018-07-23 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (468 votes). Check out past polls.

    Notices?