Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indigo Perl:hep with Apache web server

Status
Not open for further replies.

Perlwannabe

Technical User
Mar 7, 2006
57
0
0
IT
Hello,

I downloaded and installed Indigoperl as I would test my cgi scripts off-line,so using its Apache web server simulator:
I installed my script in the apache/cgi folder and my home page in apache/htdocs folder ,properly editing paths, but when I do my test to run the script functions a blank page appears...
What am I missing?
Anyone experienced with Indigo Perl is needed...

Thanks in advance for your precious help

Sincerely
 
can you check the web server error_log for information?

Can you execute the script from the cgi-bin on the server via ssh?

Is the execute bit set on the script? Set permissions to 755, rwxr-xr-x

Did you "view source" was that also blank?

Where is perl on the target server? You may have to edit the shebang to point to
#!/usr/bin/perl or wherever perl is on the actual host.

Do you have a simple "hello world" sample that fails?

Jeb Beasley
\0
 
Hi Jeb and thanks for your reply.

Your questions seem to regard a real server.
But,does Indigo Perl come with a built-in Apache web server simulator just to test cgi scripts avoiding to connect to the internet?
Have I misunderstood? Did I miss something?
For example,how could I set the permissions?
Why to edit the shebang to point the path of the "actual host"?

And,yes,the "hello world" sample fails...

Waiting news...

Thanks for interesting in

Sincerely
 
I'm sorry I misunderstood where your script was failing. I thought you developed in indigo and it failed when you deployed it.

You're correct, permissions are not a factor, nor would I think the shebang on a win32 box.

So to the remaining questions. Apache normally keeps two logs. an access log that should show the 404 response to the request for the script, and an error log that might show why the script itself failed. The Apache httpd.conf file usually indicates where these logs are stored. Probably under the apache_home/logs folder access.log and error.log

Does apache serve the content from htdocs?

What url are you placing in the browser? 127.0.0.1 or something similar?

Can you confirm that apache is running? Either via the services.msc applet, or via the following command
netstat -a

You should see a line like
TCP MYMACHINE:http MYMACHINE:0 LISTENIING

When you view the source is that also blank?

Jeb


 
Ok.

So to the remaining questions. Apache normally keeps two logs. an access log that should show the 404 response to the request for the script, and an error log that might show why the script itself failed. The Apache httpd.conf file usually indicates where these logs are stored. Probably under the apache_home/logs folder access.log and error.log

Yes,the path is apache/logs, but both files,access.log and error.log are blank.

Does apache serve the content from htdocs?

No,it doesn't.It shows only the index page;if I try to open for instance a php page it shows the code...

What url are you placing in the browser? 127.0.0.1 or something similar?

Well,I'm trying to open directly the page I "upload" in the /htdocs folder.Should I enter a url?Wich one?

Can you confirm that apache is running? Either via the services.msc applet, or via the following command
netstat -a

No,I cannot.I'm not able to use netstat command or services.msc applet...I'm pretty new to Apache...
Anyway I read in the notes it cames for default automatically running at startup.

When you view the source is that also blank?

What do you mean with "source"?

Thanks for your help.
I'm happy to see that you seem to be pretty skill about Apache issues,I hope you drive me on the right way...

Again thanks,Jeb.

I see you later




 
Mr Wannabe,
If the logs are empty either apache is not running, or you have never accessed it via a browser.

enter in the location bar of your web browser. You should see the default Apache home page. 127.0.0.1 is the local loopback address available on almost any machine having tcp/ip installed.

enter in the location bar of your browser. You should see the Apache documentation page


enter in the location bar of your browser. You should see your new page

From your browsers menu you should have a selection 'View | Source' or 'View | Page Source' depending on the browser. I prefer Firefox myself.

The access.log should now have a bunch of entries in it.

I'm not sure what you mean by 'Upload' to htdocs. Any content you want to serve from your Apache should be copied to the htdocs folder or a folder beneath it. Dynamic content, perl scripts, etc should be copied to the cgi-bin folder beneath apache.

What OS are you running? From a command window (Start | Run cmd) you should be able to run netstat. Also the Apache monitor should be visible in your system tray. It has a tiny litte 'feather' in the icon. Click on that, it should show you if apache is running, and let you restart it as well.

IndigoPerl is a pretty nice distribution.

Let me know what this uncovers.
Jeb
 
I don't know about the php, my IndigoPerl has no problem with php. Perl scripts (at least on my machine) require either changing the shebang line to the perl path on your machine, or adding this to your config file
[tt]ScriptInterpreterSource Registry[/tt]
and adding this key to your registry[tt]
HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
="your\path\to\perl.exe"
[/tt]
Regards,
John
 
Mr Wannabe,
If the logs are empty either apache is not running, or you have never accessed it via a browser.

Correct.Apache wasn't running.
I started it by the Apache.exe file in /apache/bin folder and then, I accessed my page trough the browser at address and now it runs fine!
(I also edited the shebang as simply #!perl).

I don't know,anyway,why Apache doesn't run automatically at startup and I also noticed that I cannot stop it if I would;I can only terminate the application...
Should I type any specific command?

As regard to the netstat command,I tried to run it but the console quickly shut down...
 
Is this a windows 98 box? You haven't told me the Operating system yet. You need to run netstat from a console window. you can open a console window by clicing 'Start' then 'Run' and typing cmd (three letters, cmd) If Win 95 or Win 98 type "command" Once the console (dos box) is open, enter the netstat command. But as you discovered Apache was not starting, so the netstat diagnostic is moot. It may be that the Indigo installation did not complete properly, or you are on a Win98 box that does not support the concept of services.

If not a Win98 box, Open a console session and type services.msc. This will open the Services applet and you should see Apache listed near the top of the list.

Let me know what you find. Glad to hear that you are making progress.

Jeb
 
Hi Jeb,

I apologize for my carelessness...
The OS is Win Xp.Anyway I followed your indications and opened a console:
Typing the "netstat" command I had this output:

Protocol local address external address status

TCP PB:1041 LOCALHOST:9050 ESTHABILISHED
TCP PB:1042 LOCALHOST:9051 ESTHABILISHED
TCP PB:9050 LOCALHOST:1041 ESTHABILISHED
TCP PB:9051 LOCALHOST:1042 ESTHABILISHED

Typing the "services.msc" command I had a window showing the active services on the machine,but Apache is missing...

What does it mean? How should I interpretate these outputs?

Thanks again for your patience...

Sincerely
 
If apache is missing from the services applet it means the install somehow did not complete that step. Perhaps a permissions issue. You need to have admin rights to install a service. If you study the code in the setup.bat file you will find the function "InstallApacheService"

From the code there you can construct a command line like
apache_home\bin\apache.exe -f apache_home\conf\httpd.conf -k install
(all on one line) That should install apache as a service for you. Open a console window and execute the command and report any error messages.

Find more info on service installation at

re netstat - without arguments it lists only connected ports.
With the -a argument (netstat -a) it lists all allocated ports. With apache running, and listenig on port 80, you will see a line indicating that TCP is waiting for a connection on port 80. It will tell you if apache is running or not. On occasion when apache won't start because somethng else is using the port, you can find out what else is using 80. Often it is another instance of apache running already.

If you get too much garbage with netstat - a filter it by piping it to findstr, a grep like utility found in Win32 installations

netstat -a | findstr http

You'll soon be an expert!!

Jeb\0
 
OK.that's what I done:

I saved "apache" folder and uninstalled completely Indigoperl and reinstalled it starting from the scratch,then I overwritten the "apache" folder.
Now I have three icons in the menu,to start,restart or stop the Apache service and also I have the Apache Monitor that indicates Apache is running.
I also done the netstat test filtering the command as you adviced (netstat -a | findstr http) and now it reports a TCP instance listening on http port.
It seems to run fine,right?
Or am I missing something?

Ah,the only thing I'm not able to get is the Apache service running at startup, as it should be (at least,as they say...)but that's not a real problem, better for me to run Apache only if I need it,right?

If you confirm me that I'm right with my new "settings" I have no other question to ask you (at least,I hope so...).

I see you later , Jeb

Sincerely
 
So we are making progress at least. So in the services.msc Apache is still not present?

did the command

apache_home\bin\apache.exe -f apache_home\conf\httpd.conf -k install

report any errors? (replace apache_home with our actual installation location).

If you can't get the apache service to be installed as per you can start it via the registry.

Navigate to HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/RunServices add a "string entry" Apache and enter the command line apache_home\bin\apache.exe -f apache_home\conf\httpd.conf to start it when the machine boots. You can still control it via the apache monitor tool.

Depends on how much you will be using it whether or not you want to insure that is starts when the machine starts. The good thing about running as a service is that you can set recovery parameters, and also specify the account under which it should run.

Myself, I would try to figure out why it won't install as a service.

Jeb
\0
 
Oh,I was wrong.It seems to run regularly at startup.
What deceived me was no icon shown in the system tray,as expected, but really the service works; I launched the "netstat" command after the startup and it indicates a TCP process listening on http port.Also I launched services.msc and it clearly shows an instance called "Apache 2" (why 2?)is working.
Moreover if I try to connect the localhost address I have the expected home page.
So it seems to work regularly as a service,isn't it?
The only doubt rests icon or not icon in system tray...
 
Hey Jeb? Are you there?
I loose you...

Anyway I would to thank you for your precious help;
Very grateful,hope to meet you again on this forum!

Well, see you

Take care

Sincerely

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top