Install a Perl script

Install a Perl script

Contents

1. What do you need
2. Configure the script
3. Upload perl scripts to the server


 

1. What do you need:

  1. Gets the QuizFaber perl script files (QmakeCGI.pl and QmakeQueryCGI.pl).

    These files are given with QuizFaber software. After the installing of this software, the script files are copied into your QuizFaber destination directory (as it is called into setup procedure), into the folder 'cgi-bin'.
    Otherwise, you can download they, into a ZIP file, at the following address:

    http://www.lucagalli.net/download/qmakecgi.zip

  2. A text editor : to make changes into perl script files.
    For example, Windows users can use Notepad and UNIX users can use vi or emacs.

  3. FTP Program : to move (upload) the perl script files onto your server.
    There are many that are available, such as WsFTP for Windows.
    Also, you should know how to change the permissions of a file with your FTP program.

  4. An account to a web server, for example a hosting service.

 


 

2. Configure the script

In order to run QuizFaber scripts, you'll have to modify only the first two lines of each perl script file with the correct path to the Perl interpreter, that it should appear after '#!', and the absolute directory (for example your home directory) where store archive file (with quizzes results).
Contact your System Administrator (or your hosting service) if you ignore this information, or

  1. If you have a Linux/Unix web server, type at the command line:
    which perl
    
    You should see something like:
    /usr/bin/perl
    
    This is the path to your perl interpreter. So you should change the first line of perl script (for each script) as follow:
    #!/usr/bin/perl
    
    In order to know the path of your home directory, type at the command line, just after login:
    pwd
    
    You should see something like:
    /usr/local/vhosts/my_domain.com/
    
    This is called 'Home Directory'. From this directory, you can choose a (new or existing) directory where create your archive file.
    If you decide to store archive file in your home directory, you should change the second line (for each script) of Perl script as follow:
    $file_path = '/usr/local/vhosts/my_domain.com/';
    
    It is very important that you add the slash (/) at the end of directory name.
    Also, in some case, you should creare a empty archive file (then set up the file permission with chmod 666 my_file.log). Obviously, the name will be the same choosen in the server settings of QuizFaber quiz properties.

  2. If you have a Windows web server, you could try with:
    #! C:\perl\bin\perl.exe
    $file_path = '';
    
    For Windows systems, the first line should be skipped by the Perl interpreter, so it is not an important information.
    If you do not set up the file_path variable, the archive file will be save in the same directory of CGI perl scripts.

    Don't forget to modify the path before you upload them to your server !

 


 

3. Upload perl scripts to the server

  1. Use ASCII mode when you upload the scripts to the server.

    If you're using a graphical FTP program, just click on "ASCII" (or "Text") mode, but if your FTP program has the automatical mode, be sure that files with extension .pl are managed as ASCII (or text) file.
    If you're using the a command line FTP program, you should use the 'ascii' command.

  2. After login onto your server, you are into your root directory.
    You should put the scripts in a special subdirectory, usually named 'cgi-bin'.
    Contact your System Administrator (or your hosting service) if you ignore this information.
    Be sure that your hoster enable you to CGI services.

  3. Set File Permissions.

    Permissions tell the server what the script is allowed to do, and what it is not allowed to do.

    If you're using a graphical FTP program, in order to set file permission, each one will be a bit different.
    For example using WS-FTP, you should left click on your file (into the remote host window), then right click and select (chmod) UNIX on pop-up menu.
    That will bring up a dialog window. Check the items:

    • Owner : Read Write Execute
    • Group : Read Execute
    • Public : Read Execute

    On Linux/Unix system, type at the command line:
    chmod 755 QmakeCGI.pl
    chmod 755 QmakeCGIQuery.pl