Notes
Uploading a source file without compiling locally
There have been plans for the future but we have not implemented a system yet for the client to upload a source file to the server and have the server compile it automatically on the first visit to the CGI program. More information
here.
Compiling locally before uploading to the server
Compile the program first, and once compiled rename the program to program.cgi. Upload the program into a cgi-bin directory such as
cgi-bin/program/ Upload the config file to the same directory, called pwu_win.conf or pwu_unix.conf. A copy of the standard config file is included with your download of the powerful web utilities package.
Global config file
In version 1.6.0.2, a config file is not needed in each directory if you choose to use a global config file in your htdocs/pwu/conf/ directory. Global config files can be bad though - for example some programs require different session timeouts or different session paths. To override the global config file completely, simply upload a config file local to the cgi directory that the cgi program is running.
No config file
In version 1.6.1, a config file is not needed at all if you disable the CONFIG_ON define and you use pwumain.pas rather than dynpwu.pas. To disable the CONFIG_ON define, check the pwumain.pas source file for {$DEFINE CONFIG_ON} and comment it out if it isn't already.
Permissions
On many servers the CGI-BIN directory allows your program to be named with any extension - but the appropriate executable permissions must be enabled. On some servers the executable permissions must be 755, while others must be 777, while others may be 757.
On Windows servers, you will usually need to verify with the administrator or your hosting company that exe's can be executed. Many Windows web hosting providers advertise CGI-BIN when in fact all they offer is limited Perl access from CGI-BIN, not actual full CGI-BIN rights.
On some servers, one can execute cgi files from any directory. However it is recommended that cgi programs be kept in cgi-bin incase you move to a new server which only allows access from cgi-bin.
Develop on one platform, upload to another
If you are working on a Windows machine and you need to upload to a Linux or BSD server, it is recommended that either you:
- use Compile-Studio (in examples on SVN) which allows you to upload pascal source files to any unix web server, then compile on the unix server through a web program
- use the http tunneling compiler in your IDE (fpcweb.exe) which will be available soon
- download and install Colinux/FakeLinux or Qemu and compile on virtual machine, then upload
- connect to your server through telnet/ssh if it is available, and compile on it
- connect to a linux/bsd box in your office and compile on it, then upload. It could even be an old cheap 100mhz laptop that you have sitting around doing nothing.
- cross compile - use a fpc.exe compiler that can build linux executables on your windows machine.
There will even be more options available in the future which make compiling unix applications on Windows easier.
There have been programs built which allow one to develop source code files on a Windows machine, but remotely
compile the source through a web interface. There have also been programs built to take advantage of CoLinux on Windows.
These programs are still being developed although current manual installation instructions can be seen in the articles section
of here.