Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 828937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:48:14+00:00 2026-05-15T03:48:14+00:00

I get a 500 internal server error when I try to run the code

  • 0

I get a 500 internal server error when I try to run the code below in a web server which supports perl:

#! /usr/bin/perl

use LWP;

my $ua = LWP::UserAgent->new;
$ua->agent("TestApp/0.1 ");
$ua->env_proxy();

my $req = HTTP::Request->new(POST => 'http://www.google.com/loc/json');

$req->content_type('application/jsonrequest');
$req->content('{ "cell_towers": [{"location_area_code": "55000", "mobile_network_code": "95", "cell_id": "20491", "mobile_country_code": "404"}], "version": "1.1.0", "request_address": "true"}');

my $res = $ua->request($req);
if ($res->is_success) {
print $res->content,"\n";
} else {
print $res->status_line, "\n";
return undef;
}

But there is no error when I run the code below:

#! /usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);


print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD><TITLE>Hello World!</TITLE></HEAD>\n";
print "<BODY>\n";
print "<H2>Hello World!</H2> <br /> \n";

foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}<p>" ;
}
print "</BODY>\n";
print "</HTML>\n";

So I think there is some problem with my code. When I run the first perl script in my local machine with the -wc command, it says that the syntax is OK. Help me please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:48:14+00:00Added an answer on May 15, 2026 at 3:48 am

    I assume you’re running the first script as a CGI script? You need to include the content type:

    print "Content-type: text/plain\n\n";
    

    before any other output (change text/plain to text/html or whatever is appropriate, of course!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is also Facebook Connect, to add to your list.… May 16, 2026 at 12:16 pm
  • Editorial Team
    Editorial Team added an answer Ah. Views. Took me a while as well. This answer… May 16, 2026 at 12:16 pm
  • Editorial Team
    Editorial Team added an answer What you have is fine on the events side, you're… May 16, 2026 at 12:16 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a web service in which I am manipulating POST and GET methods
I'm trying to use async workflows in F# to fetch several web requests. However,
I'm trying to enable .htaccess files on a Ubuntu server I set up. I
I'm trying to improve the information provided in response to an error handled within
How to get width and height of an image? I have $variable = 'http://site.com/image.png
Suposse I have the next MySQL database with 500.000 rows : users { id
I can't seem to get the dialog to open to the height I want,
I have been trying to get the unique values in each column of a
I'm writing up a document about page faulting and am trying to get some
I have downloaded the jQuery outside events plugin as Sarfraz suggested, which seems really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.