LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 01-06-2011, 12:03 AM   #1
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Rep: Reputation: Disabled
Running my perl cgi script


I'm using cygwin to write my code, and I have done so with the

#!/usr/bin/perl -w

tag at the beginning. For some reason when I load the script from the browser I get my code, it's not running it correctly. My code is locally on my machine, in my C:\cygwin\home\MyKoL\ folder, along with my html code linking to the cgi script. My script runs fine when I use the shell to load it with the perl command out front, so I'm thinking it compiles correctly, I just doesn't link correctly.
 
Old 01-06-2011, 03:23 AM   #2
pgpython
Member
 
Registered: Dec 2005
Location: Sheffield, UK
Distribution: Gentoo
Posts: 142

Rep: Reputation: 32
For a start, more info about the problem your having would be appreciated. Like the apache error log as well as the apache config file. It sounds as though it might be a permission problem. Make sure that apache has permission to execute your script and and check the config file that the permissions are set correctly for viewing that page
 
Old 01-06-2011, 10:13 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Looks like an "Apache (IHS?) on Windows" problem to me - moving to <GENERAL>.



Cheers,
Tink
 
Old 01-06-2011, 11:52 AM   #4
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
I added the apache package to the cygwin program, not sure what permissions I have to add and to what file. I'm not sure where to find the apache error log or the config file for it.
 
Old 01-06-2011, 03:07 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by mykolg View Post
I added the apache package to the cygwin program, not sure what permissions I have to add and to what file. I'm not sure where to find the apache error log or the config file for it.

Code:
cd /etc
ls apach*
Check apache/apache2 dir (don't know which one you installed) for
httpd.conf and check/edit the logfile setting.



Cheers,
Tink
 
Old 01-06-2011, 04:25 PM   #6
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
I have both the apache and the apache 2 directory. And that file is found in both of them, how should I go about editing this file?
 
Old 01-06-2011, 04:27 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Ummm ... use vi?

And which of the apaches are you actually running? You wouldn't have them go
in parallel I assume?


Cheers,
Tink
 
Old 01-06-2011, 04:38 PM   #8
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
I like to use nano myself. I meant more like, what should I edit in that file to correct this issue.

As for the Apache, I'm not sure how it's running there seems to be a httpd.config.default in the apache folder, so I'm guess that this might be the default program to be used? When I installed the package in cygwin I typed in the name and then from the selected tree I choose to install all.
 
Old 01-06-2011, 04:54 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
When you do
Code:
ps -ef | grep http
what do you get?


Cheers,
Tink
 
Old 01-06-2011, 05:00 PM   #10
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
It does nothing at all just goes back to the command line.
 
Old 01-06-2011, 05:16 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
So before worrying about why the cgi script isn't executing you
may want to try and find out how to set apache up on cygwin...

It's not running at all.



Cheers,
Tink
 
Old 01-06-2011, 05:46 PM   #12
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Dang, well I'm rather confused on how to go about this. I went to a website that I googled online and I set the setups are differently when I loaded it using the cygwin setup program to do so and tried understanding that but what it bothering me is that I used the cygwin setup program to add the apache package to it.

Do you know anything about this, or where I could find some information to help me with this?
 
Old 01-06-2011, 06:14 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
The cygwin set-up only installs the package; it doesn't do any configuration
of apache, not does it set apache up as a service.

2 minutes on google led me here ... looks promising.



Cheers,
Tink
 
Old 01-06-2011, 08:27 PM   #14
mykolg
LQ Newbie
 
Registered: Jan 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
I followed the instructions until the Apache2 error came up, hopefully you can follow what I did from below.

Code:
MyKoL@MyKoL-HP ~
$ /bin/cygserver-config
Overwrite existing /etc/cygserver.conf file? (yes/no) yes
Generating /etc/cygserver.conf file


Warning: The following function requires administrator privileges!

Do you want to install cygserver as service?
(Say "no" if it's already installed as service) (yes/no) yes

The service has been installed under LocalSystem account.
To start it, call `net start cygserver' or `cygrunsrv -S cygserver'.

Further configuration options are available by editing the configuration
file /etc/cygserver.conf.  Please read the inline information in that
file carefully. The best option for the start is to just leave it alone.

Basic Cygserver configuration finished. Have fun!


MyKoL@MyKoL-HP ~
$ net start cygserver
The CYGWIN cygserver service is starting.
The CYGWIN cygserver service was started successfully.


MyKoL@MyKoL-HP ~
$ net start cygserver
The requested service has already been started.

More help is available by typing NET HELPMSG 2182.


MyKoL@MyKoL-HP ~
$ /usr/sbin/apachetl2 start
bash: /usr/sbin/apachetl2: No such file or directory

MyKoL@MyKoL-HP ~
$ /usr/sbin/apachectl2 start
(112)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

MyKoL@MyKoL-HP ~
$

Last edited by mykolg; 01-06-2011 at 10:32 PM.
 
Old 01-07-2011, 03:24 PM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by mykolg View Post
I followed the instructions until the Apache2 error came up, hopefully you can follow what I did from below.

Code:
MyKoL@MyKoL-HP ~
$ /usr/sbin/apachectl2 start
(112)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

MyKoL@MyKoL-HP ~
$
I can only guess that a) some instance of apache (maybe the older
apache rather than apache2) is running ... or maybe b) IHS? I really
don't know much about windows, or cygwin, for that matter.


To find out whether it's a process from within cygwin use the old
ps -ef from above again. If that's not it, find out whether your
windows has a webserver going.



Cheers,
Tink

Last edited by Tinkster; 01-07-2011 at 03:50 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with perl modules declaration and perl/cgi script shifter Programming 9 02-24-2010 09:09 AM
problems in running cgi/perl scripts... raymond Linux - General 17 02-09-2010 04:06 AM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 04:34 AM
Running Perl/CGI scripts hso_sof Linux - Newbie 3 08-22-2003 10:26 AM
Need help for running perl/cgi... raymond Linux - General 2 11-20-2002 08:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 05:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration