Possible scenarios - hakakou/optiperl GitHub Wiki
Below you will find a list of common (and uncommon!) server configurations, and how to re-create and test them offline using OptiPerl. For the examples below we are using c:\webs\ as our local folder. You can of course change this to anything you want.
Scenario 1
Your remote server's path looks like this:
/index.html
/cgi-bin/
/cgi-bin/test.pl
When requesting
http://www.mysite.com/index.html
you get/index.html
http://www.mysite.com/cgi-bin/test.pl you get /cgi-bin/test.pl
This is the easiest setup.
Your offline folder will look like
c:\webs\mysite\index.html
c:\webs\mysite\cgi-bin
c:\webs\mysite\cgi-bin\test.pl
Project Options
Local starting directory: c:\webs\mysite\
Corresponds to: /
Project Options / Internal server
Root path: c:\webs\mysite
Transfer Sessions / Remote running
Document Root: /
Links to: http://www.mysite.com/
Scenario 2
Your remote server is apache with mod_perl and looks like this:
/htdocs/index.html
/cgi-bin/test.cgi
/perl/fastscript.pl
When requesting
http://www.mysite.com/index.html
you get/htdocs/index.html
http://www.mysite.com/cgi-bin/test.cgi
you get/cgi-bin/test.pl
http://www.mysite.com/perl/fastscript.pl
you get/perl/fastscript.pl
Your offline folder will look like
c:\webs\mysite\htdocs\index.html
c:\webs\mysite\cgi-bin\test.cgi
c:\webs\mysite\perl\fastscript.pl
Project Options
Local starting directory: c:\webs\mysite\
Corresponds to: /
Project Options / Internal server
Root path: c:\webs\mysite\htdocs
Aliases: /cgi-bin/=c:\webs\mysite\cgi-bin\; /perl/=c:\webs\mysite\perl\;
FTP Sessions / Remote running
Document Root: /htdocs/
Links to: http://www.mysite.com/
Aliases: /cgi-bin/=http://www.mysite.com/cgi-bin/; /perl/=http://www.mysite.com/perl/;
Scenario 3
Your remote server looks like this:
/users/students/disk1/george/public_html/index.html
Also after some begging of the sysadmin, he allows you to upload perl scripts to
/usr/local/apache/cgi-bin/george/
When requesting
http://www.site.edu/~george/index.html
you get
/users/students/disk1/george/public_html/index.html
http://www.site.edu/~george/cgi-bin/test.pl
you get
/usr/local/apache/cgi-bin/george/test.pl
Setup Option A
Your offline folder will look like
c:\webs\mysite\index.html
c:\webs\mysite\cgi-bin\test.cgi
Project Options
Local starting directory: c:\webs\mysite\
Corresponds to: /users/students/disk1/george/public_html/
* read below about the cgi-bin folder when uploading the project.
Project Options / Internal server
Root path: c:\webs\mysite\
Transfer Sessions / Remote running
Document Root: /users/students/disk1/george/public_html/
Links to: http://www.site.edu/~george/
Aliases: /usr/local/apache/cgi-bin/george/=http://www.site.edu/~george/cgi-bin/;
- Note that the cgi-bin must be uploaded to a completely different path, and not under the starting directory. So select the cgi path in the project manager, right click and select "Override destination path". In the dialog box, enter
/usr/local/apache/cgi-bin/george/.
This needs to be done only once.
Also note that this setup will create problems if the cgi scripts needs to access files from the public_html folder. You will need to use the version converter to change the lines in the script for the Local and Server version. There is however another way to set this project up so this wont be a problem:
Setup Option B
Your offline folder will look like
c:\webs\mysite\users\students\disk1\george\public_html\index.html
c:\webs\mysite\usr\local\apache\cgi-bin\george\test.pl
Project Options
Local starting directory: c:\webs\mysite\
Corresponds to: /
Project Options / Internal server
Root path: c:\webs\mysite\users\students\disk1\george\public_html\
Aliases: /cgi-bin/=c:\webs\mysite\usr\local\apache\cgi-bin\george;
Transfer Sessions / Remote running
Document Root: /users/students/disk1/george/public_html/
Links to: http://www.site.edu/~george/
Aliases: /usr/local/apache/cgi-bin/george/=http://www.site.edu/~george/cgi-bin/;
Using this setup, if you need to access files of the public_html folder from the cgi-script and don't want to use the version converter, you can access them using relative paths. For example, for test.pl to access index.html, it would use:
../../../../../users/students/disk1/george/public_html/index.html
This would work on both window and unix.