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 535k
  • Answers 535k
  • 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 First off, a disclaimer - I'm not an application developer,… May 17, 2026 at 12:59 am
  • Editorial Team
    Editorial Team added an answer $(function(){ $('<img>').attr('src','loading.gif'); // preload the "loading" image. $('#content > img').each(function(){… May 17, 2026 at 12:59 am
  • Editorial Team
    Editorial Team added an answer Edit: I provided some headings and divided RFCs by topic.… May 17, 2026 at 12:59 am

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 get .NET Remoting to work on Windows Azure, with a web
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
I know about the option to set the internal memory ini_set(memory_limit,30M); But I wanted
How can I get an indication of what part of a long document is
I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently
I am currently on a shared hosting plan with iis 7.0 I have an
I'm trying to implement a solution using .htaccess and wildcard subdomains so that http://subdomain.example.com

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.