Page 1 of 3

testing perl offline (XP) 1.7.7

PostPosted: 09. November 2011 01:26
by moneysav
Hi Everyone, I am a soul in distress !

This is my first post and I'm new to using Apache.

I have a web site which is using Perl within its many sub programs. The main page contains a html header and footer.
I have been editing my Perl scripts on my home computer and then uploading the scrips via my filezilla ftp program. After the upload I would refresh my webs main page to see if I had made any errors or not. (usually I do and the program crashes) and I hastelly have to undo the changes back and re-upload the file before a visitor sees my crash errors page.

I have had enough of that and wanted to create and pre-test my Perl scripts off-line first and then upload.

I read that Apache would allow me to test my Perl code offline, and downloaded the file. The installation went smoothly. No errors. I was able to bring up the Apache control console and it looked nice.

Since there is no documentation manual in English, I am at a loss on how to fix my problem so here I am.

My problem is when I am offline, I open my ie7 browser on my windows xp computer and the browser works. I do get the Xampp greating page when I search for it and my other html pages show up too.

When I type in the ie7 browers window the html page for my web site "f:/.....path..../index.html", the index.html page shows up. The html print statements show up, but where the link is to go to my xyz.pl is, there is no action.

I am pretty sure that I have the path config correct.
The html link to the Perl "xyz.pl" page is:
<a href="127.0.0.1/f:/......path..xyz.pl"></a>

In my xyz.pl file, the first line is:
#!perl
#!"F:\program files\xampp\perl\bin\perl.exe"

I have tried to change the file permission of both index.html and xyz.pl to "read" but this did not help.

I had XAmpp open and running in the background while off-line.

It seems that the Perl coding is not recognized even with my Norton Internet Security turned off during my offline trials.

Have I done something wrong? Have I set my paths properly?
Cheers

Re: testing perl offline

PostPosted: 09. November 2011 01:37
by Sharley
First and foremost you should not install XAMPP to a folder with spaces or special characters as this can cause issues down the track as most of the XAMPP components are ported from the Linux environment where space and special characters are not used.
Read the readme-en.txt file with regard to installation.

You can't use a path in your browser to access files that need to be parsed by the server like php file and perl scripts, you need to use a URL so the request goes through the Apache server.

http://localhost/ will give you the Welcome (Admin) php pages if Apache and MySQL are running.

You also need to put your web site in the \xampp\htdocs folder (DocumentRoot) so you would then type in your browser:
http://localhost/mywebsite/xyx.pl

In my xyz.pl file, the first line is:
#!perl
#!"F:\program files\xampp\perl\bin\perl.exe"
The shebang (first line) should be
#!"F:\program files\xampp\perl\bin\perl.exe"

There are test perl scripts in the xampp\cgi-bin folder and they can be accessed in your browser by typing:
http://localhost/cgi-bin/perltest.pl
http://localhost/cgi-bin/cgi.cgi
http://localhost/cgi-bin/printenv.pl

They can be opened for reading and editing, like most text based scripts, in a text editor.

Re: testing perl offline

PostPosted: 09. November 2011 01:55
by moneysav
about the xampp folder, I do have the folder in my "program files" folder. Can I easily move the xampp folder elsewhere ?

Thanks about the other info. I'll do the changes and test it.
Cheers

Re: testing perl offline

PostPosted: 09. November 2011 02:03
by Sharley
Yes you can move it but first you have to uninstall any Windows services by removing the ticks in the Svc boxes in your XAMPP Control Panel.

Once you have no ticks and you have stopped any components that are running you can then Exit the Control Panel.

If you try and move the xampp folder before making sure that everything is stopped and the ticks removed and the CP exited then you may hit some unexpected errors after moving to a new location.


Once you are satisfied that the above is true then you can move the xampp folder to a location in the root of a drive.

You must then run the setup_xampp.bat file found in the xampp folder to have it set all the new paths for the new XAMPP location.

Test by going to:
http://localhost and running all the demos in the left frame menu.

Re: testing perl offline

PostPosted: 09. November 2011 02:38
by moneysav
thanks, I'll do it and report back.
cheers

Re: testing perl offline

PostPosted: 09. November 2011 03:06
by moneysav
IS THIS OK?
if "%1" == "sfx" (cd f:\xampp

after the move to f:\xampp apache services is working but MySql is not working
cheers

Re: testing perl offline

PostPosted: 09. November 2011 03:12
by moneysav
do I have to move my entire folder containing my .pl programs, files and docs and photos htdocs ? or just the relavent .pl files?

Re: testing perl offline

PostPosted: 09. November 2011 03:18
by Sharley
You need to move the whole xampp folder totally including all files and folders in the htdocs folder.

If you have the files you mention in another location other than the xampp folder then to be able to use them they also need to be moved to the htdocs folder.

Exit the 2.5 version of the XAMPP control Panel and use the new version 3 panel xampp-control-3-beta.exe found in the xampp folder, as it gives better error messages in the log window and also creates a log file in the xampp folder so you can copy and paste it here.
There is also access to log and congig files and much more for you to experiment with. :)

Make sure there are no green ticks in the services module column as you don't need to run Apache and MySQL every time Windows starts at this stage of testing.

What is this and where are you seeing or using it?
IS THIS OK?
if "%1" == "sfx" (cd f:\xampp
seems to be only part of something? and no need to shout as I hear you quire well. :)

Re: testing perl offline

PostPosted: 09. November 2011 04:25
by moneysav
ok let's update:
1: the if "%1"== thing was found in setup_xampp.bat file, you told me to update the path. So I added the "f:"

2: moved all my website files to f:\xampp\htdocs folder. My sites' folder name was "_" because it was in a chain of folders so I guess I'll have to rename it to something and change ALL the internal folders links to match.

3: after the xampp folder move, I used the beta 3 controll panel. It is running and apache and mysql with no errors. Nicer panel

Re: testing perl offline

PostPosted: 09. November 2011 04:33
by Sharley
No where did I tell you to edit the setup_xampp.bat file.

There was no need to edit the setup bat file as it will do all the path work auto magically so best put it back to it's original state - then try running it again and if there is nothing to do it will tell you.

So everything is working as it should with XAMPP?

Re: testing perl offline

PostPosted: 09. November 2011 04:50
by moneysav
you are correct. my mistake. I interpreted run to mean edit. (told you I was new to this), Anyway clicked on the batch file and it automatically updated all the paths. Turned on controll panel and apache and mysql is now running and green.
(wheeeew)

I have noticed that there are 2 folders for xampp.

1 is the main folder
2nd xampp folder is in htdocs.

which folder 1 or 2 do I put my renamed "test" folder into?
then I will have to change all the paths in (my) .pl files to reflect the change in directory?

cheers,
Moneysav

Re: testing perl offline

PostPosted: 09. November 2011 04:59
by Sharley
You put your test folders and files in the htdocs only which is the server's DocumentRoot or web root in Linux jargon.

Then http://localhost/testfolder/testfile.pl

Remember to change the shebang to
Code: Select all
#!"F:\xampp\perl\bin\perl.exe"


The xampp folders are xampp system file folders and you should not add or delete any files or folders contained in them or your XAMPP installation may explode in a puff of blue smoke and blast off to the moon. :D

Also the Apache server would not find your web site test files and folders if you put them in the xampp folders.

Re: testing perl offline

PostPosted: 09. November 2011 05:12
by moneysav
ok this is what the dir looks like:
f:/xampp/htdocs/test/all my files

if this looks good then I will proceed to change all the paths in my files
I will wait for your confirmation.
cheers
Moneysav

Re: testing perl offline

PostPosted: 09. November 2011 05:20
by Sharley
Perfect, but if you get issues with test then change it to mytest or similar, but I don't see any problems.
http://localhost/test/test.pl should give you a result to smile about. :)

Let me know when you are running in top gear with a big grin on your face. :D

Good luck and best wishes. :)

Re: testing perl offline

PostPosted: 09. November 2011 06:31
by moneysav
before I made any changes, I went offline. Had xampp control panel open with all green on apache and mysql.

copied "http://localhost/xampp/htdocs/test/public_html/index.html" into my web browser and got

Internet Explorer cannot display the webpage


what now?
cheers,
moneysav