Received 404 not found error on existing CGI script

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Received 404 not found error on existing CGI script

barry kimelman-2
my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

--

Barrry Kimelman
Winnipeg, Manitoba, Canada
Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

angel Hall-Coulston
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

--

Barrry Kimelman
Winnipeg, Manitoba, Canada

Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

John Iliffe
It seems a bit self-evident, but have you checked that Apache has permission to access your
cgi-bin directory?

John
==============================================
On Wed, 2020-06-24 at 17:14 +0100, angel Hall-Coulston wrote:
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

--

Barrry Kimelman
Winnipeg, Manitoba, Canada

Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

Nick Kew-3
In reply to this post by barry kimelman-2


> On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:
>
>
> What have I done wrong?

You've had some good advice from others.  But also check your shebang line.

--
Nick Kew

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

barry kimelman-2
In reply to this post by angel Hall-Coulston
Hello,

Thanks for your reply. I solved the not being able to run a Perl CGI script issue. I now have several of my old Perl CGI scripts up and running.

Now one of my other CGI scripts is failing badly. The mysql error log does not show anything useful. All I see on my screen is a '500 internal server error'. I checked the syntax of my perl script and it is ok.

Your message stated that setting "my log file level to debug" was a good debugging idea. I have been trying to figure out how to accomplish this task with no success. Which config file do I need to change and what specific change do I need to make to the config file ?

Thanks/

On Wed, Jun 24, 2020 at 11:15 AM angel Hall-Coulston <[hidden email]> wrote:
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

--

Barrry Kimelman
Winnipeg, Manitoba, Canada



--

Barrry Kimelman
Winnipeg, Manitoba, Canada
Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

Jim Albert
Check your Apache error log. It's unlikely anything in your mysql log will be useful here. Apache will print any STDERR messages to the Apache error log. You shouldn't need your Apache logging at anything other than the default logging level to be useful to debug your Perl CGI issue.

Jim

On 6/25/2020 2:58 PM, barry kimelman wrote:
Hello,

Thanks for your reply. I solved the not being able to run a Perl CGI script issue. I now have several of my old Perl CGI scripts up and running.

Now one of my other CGI scripts is failing badly. The mysql error log does not show anything useful. All I see on my screen is a '500 internal server error'. I checked the syntax of my perl script and it is ok.

Your message stated that setting "my log file level to debug" was a good debugging idea. I have been trying to figure out how to accomplish this task with no success. Which config file do I need to change and what specific change do I need to make to the config file ?

Thanks/

On Wed, Jun 24, 2020 at 11:15 AM angel Hall-Coulston [hidden email] wrote:
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

--

Barrry Kimelman
Winnipeg, Manitoba, Canada



--

Barrry Kimelman
Winnipeg, Manitoba, Canada



  



	
	
	
	
Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

angel Hall-Coulston
In reply to this post by barry kimelman-2
Hi,
Check your config file with the command 'httpd -V' but speaking from a 'Mac users' perspective it’s usually found here:    /etc/apache2/httpd.conf
About 3/4 down you’ll find log formats etc and several suggested log levels. You can change back after you have solved the issue because 'debug' can/will fill your log files up pretty quickly with the extra info.
Angel Hall-Coulston
Scotland.
On 25 Jun 2020, at 19:58, barry kimelman <[hidden email]> wrote:

Hello,

Thanks for your reply. I solved the not being able to run a Perl CGI script issue. I now have several of my old Perl CGI scripts up and running.

Now one of my other CGI scripts is failing badly. The mysql error log does not show anything useful. All I see on my screen is a '500 internal server error'. I checked the syntax of my perl script and it is ok.

Your message stated that setting "my log file level to debug" was a good debugging idea. I have been trying to figure out how to accomplish this task with no success. Which config file do I need to change and what specific change do I need to make to the config file ?

Thanks/

On Wed, Jun 24, 2020 at 11:15 AM angel Hall-Coulston <[hidden email]> wrote:
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

-- 

Barrry Kimelman
Winnipeg, Manitoba, Canada




Reply | Threaded
Open this post in threaded view
|

Re: Received 404 not found error on existing CGI script

Mike Rumph-2
Try the following link for basic info on using CGI with Apache httpd:

On Fri, Jun 26, 2020 at 1:03 AM angel Hall-Coulston <[hidden email]> wrote:
Hi,
Check your config file with the command 'httpd -V' but speaking from a 'Mac users' perspective it’s usually found here:    /etc/apache2/httpd.conf
About 3/4 down you’ll find log formats etc and several suggested log levels. You can change back after you have solved the issue because 'debug' can/will fill your log files up pretty quickly with the extra info.
Angel Hall-Coulston
Scotland.
On 25 Jun 2020, at 19:58, barry kimelman <[hidden email]> wrote:

Hello,

Thanks for your reply. I solved the not being able to run a Perl CGI script issue. I now have several of my old Perl CGI scripts up and running.

Now one of my other CGI scripts is failing badly. The mysql error log does not show anything useful. All I see on my screen is a '500 internal server error'. I checked the syntax of my perl script and it is ok.

Your message stated that setting "my log file level to debug" was a good debugging idea. I have been trying to figure out how to accomplish this task with no success. Which config file do I need to change and what specific change do I need to make to the config file ?

Thanks/

On Wed, Jun 24, 2020 at 11:15 AM angel Hall-Coulston <[hidden email]> wrote:
Try setting your log file level to debug, you will get far more information. Also at the end of the 'log format' code in your configuration file (easy double check by command 'httpd -V' which will double check your conf file) add '%L' which when added to both access_log file formats AND error_log formats will give matches between the two easily found with the 'grep' command 'grep "[long-scrambled-unique-characters-for-that-particular-error] '*_log' . Make sure you first are in the log directory.

Another helpful tip… your apache comes with it’s VERY OWN manual pages which when enabled in your 'includes' section of your config file, will allow you to access MUCH quicker than going online, where you will find everything you need to know. 

Angel Hall-Coulston
Scotland.

On 24 Jun 2020, at 00:35, barry kimelman <[hidden email]> wrote:

my system is an ubuntu 20.04 lts laptop.

I successfully installed apache2. I verified the installation by visiting http://localhost:80

Now I am having problems trying to run a Perl CGI script which I had running under Windows 10 on  Apache 2.4

I modified the sites-enabled/000-default.conf file by removing the '#' from the start of the "Include conf-available/serve-cgi-bin.conf" line. I then created the /usr/lib/cgi-bin directory. I next put a small Perl CGI script named "printenv.cgi" under /usr/lib/cgi-bin. I then restarted the apache2 server. When I attempted to run my newly created CGI script gy visiting localhost:80/cgi-bin/printenv.cgi all that happened was I received a "404 Not Found" error. I looked at the apache logfile and it provided no further info.

I even tried using the "wget" command. same 404 error.

What have I done wrong?

-- 

Barrry Kimelman
Winnipeg, Manitoba, Canada