testing perl offline (XP) 1.7.7

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Re: testing perl offline

Postby Sharley » 09. November 2011 06:37

http://localhost/xampp/htdocs/test/public_html/index.html
Bzzz! Wrong. ;)
I won't blame the air down in Vic. :D

I thought I had explained it for you when I posted similar to this here:
viewtopic.php?p=188159#p188159

This is correct for your directory tree (click on this link to test):
http://localhost/test/public_html/index.html

Spot the difference?

http://localhost is the DocumentRoot (xampp\htdocs) and so no need to add that to any of your addresses.

Errors are best read from the \xampp\apache\logs\error.log file not from the browser as browsers use a canned response only.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: testing perl offline

Postby moneysav » 09. November 2011 12:52

ok. Now if I type http://localhost/test/public_html/index.html into the browser, I do get the proper index.html appearing. Thats a start.

The text in the html page is appearing, but the link to my xyz.pl is not working. I don't get an error message but it just seems to be frozen and not doing anything.

the link in my html page is:
<a href="http://localhost/xampp/xyz.pl"></a>

Cheers,
Moneysav
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby Sharley » 09. November 2011 13:36

Once again the link you are using does not require you put the xampp folder ever.

The xampp folder in the htdocs folder is for XAMPP system files only and should not be used to put your own files or folders in.

If your xyz.pl file is in the htdocs folder then your clickable link would be
Code: Select all
<a href="http://localhost/xyz.pl">xyz</a>
If your xyz.pl file is in myfolder in the htdocs folder (not in the xampp folder ever) then your clickable link would look like this
Code: Select all
<a href="http://localhost/myfolder/xyz.pl">xyz</a>
Please let me know back if you don't understand what I am trying to get across. :)

If you suspect that your xyz.pl file is faulty but still want to test that your links work then substitute your xyz.pl file with printenv.pl copied from the F:\xampp\cgi-bin folder to the htdocs folder or copied to your myfolder.

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: testing perl offline

Postby moneysav » 09. November 2011 14:49

Hi,
I tried your reccommendation and copied the printenv.pl into the htdocs folder.

I went offline and made sure that the control panel was running green.

I added your code for the link to my index.html page like this:
<a href="http://localhost/printenv.pl">click here Printenv.pl</a>

the html page come up and when I clicked on the link, I got:

file download - security warning for printenv.pl
do you want to (open) (save) (cancel)
If I clicked on open, then it asked me what program do I want to use to open printenv.pl ?

What next?
cheers
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby Sharley » 09. November 2011 14:56

First check that the shebang is correct in the file you copied printenv.pl
Code: Select all
#!"F:\xampp\perl\bin\perl.exe"
If not then correct it.

If it is correct then tell me what happens when you type this in your browser:
http://localhost/cgi-bin/printenv.pl
and then this:
http://localhost/cgi-bin/perltest.cgi
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: testing perl offline

Postby moneysav » 09. November 2011 15:05

yes, shebang in printenv.pl is correct.

http://localhost/cgi-bin/printenv.pl
response> do you want to open or save this file.

http://localhost/cgi-bin/perltest.cgi
response> GCI with MiniPerl
CGI with MiniPerl is ready ...

I hope having the control panel active when I am online does'nt affect anything?
cheers
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby moneysav » 09. November 2011 15:15

Its 1:17am think I'll tackle more in the morning.
cheers,
Moneysav
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby Sharley » 09. November 2011 15:27

1 hour behind you here and me too am ready for some shut eye. :)

For the morning then...

...no the control Panel will not affect what you are doing, you can leave that in the open or drop it to the tray by clicking on the X in the top right - that does not close the panel - the Quit button exits the panel.


This is really strange because I have the same XAMPP 1.7.7 and I am replicating everything you do and I can't get this problem with the .pl scripts wanting to open or save, they all work fine - but I don't use IE.


I have an old IE6 and it asked me the same question when I went to http://localhost/printenv.pl also when I went to http://cgi-bin/printenv.pl but when I clicked on Open it loaded the printenv.pl correctly parsed by perl.exe in my text editor.
I associated .pl scripts for editing with my text editor and you may need to do the same - right click and select to open with your text editor.


This line is the problem with IE
print "Content-type: text/plain; charset=iso-8859-1\n\n";
It will open a text editor to display the perl script duly parsed by the perl.exe file and looks correctly formatted.

If I change that line to
print "Content-type: text/html\n\n";
then IE opens the printenv.pl file in a browser window but with no formatting of the text, it is all in one paragraph and very hard to read.

So my suggestion is to click on Open when asked and see if it produces a nice looking page in your text editor if you associated .pl files with your text editor.

Or use another browser like Firefox etc. when running your scripts locally.

It may only be the above printenv.pl file that gives issues because of the text/plain type in the print statement.

So try your own scripts now and see if you have the same issue - never did find a use for IE (only for testing web sites I develop so they look the same in all browsers).
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: testing perl offline

Postby moneysav » 09. November 2011 21:57

Well the birds are out making noises so it must be morning.

Activated xampp and this is the display.

7:24:03 AM [main] Initializing main
7:24:03 AM [main] Windows version: 5.1 (build 2600) - Service Pack 3
7:24:03 AM [main] Xampp version: 1.7.7
7:24:03 AM [main] Control center version: 3.0.2 [ Compiled: Jul 21th 2011 - build #1 ]
7:24:03 AM [main] Running as admin - good!
7:24:03 AM [main] Working with basedir: "f:\xampp\"
7:24:03 AM [main] Initializing moduls
7:24:03 AM [apache] "f:\xampp\apache\bin\httpd.exe" seems to be running on port 80?
7:24:03 AM [apache] "f:\xampp\apache\bin\httpd.exe" seems to be running on port 443?
7:24:03 AM [mysql]"f:\xampp\mysql\bin\mysqld.exe" seems to be running on port 3306?
7:24:03 AM [main] Starting check-timer

is there a possible problem here ?


------------------------
changing the print line in printenv.pl gives me the same unformatted output in my browser as yours did, but thats no help since I cannot see the results of the .pl file.

we know that .cgi gives us no problems, but .pl is giving a problem.

When I view my site on line, there are tons of perl script that needs to be run and displayed in the correct format and my sites' webserver seems to be doing that nicely, but my simulated webserver is not (xampp).

It is hard to believe that (xampp) and ie7 may not be compatible? I think that we are missing something.
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby hackattack142 » 09. November 2011 23:21

The control panel does a check of ports when it starts to make sure other programs are not blocking required XAMPP ports. In your case, you do not have to worry since those are xampp programs running.

I tried and can load http://localhost/xampp/perlinfo.pl from firefox and IE9 as expected.
Last edited by hackattack142 on 10. November 2011 01:03, edited 1 time in total.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: testing perl offline

Postby moneysav » 09. November 2011 23:30

tried something this morning:
this is the line in my index.html:
<a href="http://localhost/printenv.pl">click here Printenv.pl</a>

this is my printenv.pl
#!"F:\xampp\perl\bin\perl.exe"
##
## printenv -- demo CGI program which just prints its environment
##
## print "Content-type: text/html\n\n";
print "Content-type: text/plain; charset=iso-8859-1\n\n";

print "I am here in printenv.pl";
## foreach $var (sort(keys(%ENV))) {
## $val = $ENV{$var};
## $val =~ s|\n|\\n|g;
## $val =~ s|"|\\"|g;
## print "${var}=\"${val}\"\n";
## }

when I clicked on index.html in windows explorer, a new window opens in my browser and I clicked on the link >click here Printenv.pl<

then I got the open with dialog box and picked editpadlite (the editor I am using) and I got an output window to Editpadlite that prints the "I am here...." with no errors.

so appearently perl is detecting my code and printing it correctly. The problem is that the correct output is going to my Editpadlite and not to the ie7 browser that does not associate .pl files

When I tried the same test but this time I clicked on open with ie7, I keep getting into an loop of it trying to open the file and then asking me again what file to associate it with.

I think this is where the problem. Telling ie7 how to open .pl file
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby moneysav » 09. November 2011 23:40

I tried another test. I deliberately left off the last quote mark from printenv.pl

from:
print "I am here in printenv.pl";

to:
print "I am here in printenv.pl;


and got this error message in the browser:
Server error!
Error message:
syntax error at F:/xampp/htdocs/printenv.pl line 14, near ""|g; ## print "${var}" ,

So it seems that perl.exe is seeing my code and interpreting it correctly. Only that the output is not being associated with the ie7 browser. What do you think?

Good Morning !
cheers
Moneysav
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

Re: testing perl offline

Postby Sharley » 10. November 2011 00:49

The red items in my previous post are the problem.
Please reread that post as it has all the details about why you are having issues with printenv.pl,

In IE6 and by your account in IE 7 there is a problem, In IE8?, in IE9 No problems.

You can't or at least I could not associate .pl files that use text/plain to open in IE6 but they did open in my text editor when I associated the .pl files with my text editor.

In XP I doubt you can upgrade to IE8 or IE9 but if you can then go for it or use Firefox (best solution) until you also upgrade your OS.

I get round these kinds of Microsoft issues in XP by not using MS products where possible.

Have you tried your own .pl scripts yet?

You may need to forget about the printenv.pl until you upgrade your IE your OS.

I have only IE6 and as pointed out in my last post it will not print the environment variables in a browser window but will print then when I select to Open when asked because I have associated .pl files with my text editor (yours is Editpadlite).

The CP3 log is correct.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: testing perl offline

Postby hackattack142 » 10. November 2011 01:21

It also works on IE8 (Tested with Win XP SP3) without any dialogs or anything popping up and the output is displayed correctly in the browser. If your heart is set on using IE, you could consider upgrading to IE8 (don't think IE9 is available for XP).
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: testing perl offline

Postby moneysav » 10. November 2011 01:40

yikes !

so my options are upgrade to ie9 or continue to modify my sites' .pl programs and upload them untested.

Hmmmmm. That one I have to think about.
any costs to upgrading to ie9 or potential damages to my system ?
cheers
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
Operating System: windows xp

PreviousNext

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 48 guests