Apache mod_actions

Discussion in 'Server Operation' started by dualxeon, Feb 17, 2008.

  1. dualxeon

    dualxeon New Member

    Hi,
    I have tried to setup apache with mod_actions so that when a page is requested e.g test.pl my cgi script is run and the results are returned to who ever requested the page.

    In my virtual host i have added the following settings:

    Code:
    Action perlfiles /home/admin/test.cgi
    AddHandler perlfiles .pl
    
    the cgi contains the following:

    Code:
    #!/bin/bash
    echo "HELLO THIS WORKS :)";
    
    I then made a file test.pl and when i go to that file in my browser i get very weirdly a 404 error:confused:

    Code:
    Not Found
    The requested URL /home/admin/test.cgi /test.pl was not found on this server.
    
    If i remove this Action perlfiles /home/admin/test.cgi from the configuration then i do not get the 404 error, but my script does not run.

    Any ideas how i could fix this problem?
    I would really appreicate any help,
    Thanks,
    Alex
     
  2. Leszek

    Leszek Member

    I don't know why the 404 but shouldn't the cgi script contain
    #!/bin/perl ?
    How about file permissions ?
     
  3. dualxeon

    dualxeon New Member

    The file is owned by the apache user and has execute permissions for all users

    Code:
    shouldn't the cgi script contain
    #!/bin/perl ?
    i dont actually want to run the perl script at the moment, i just want all perl scripts to output HELLO THIS WORKS for now
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Any errors in Apache's error log?
     
  5. dualxeon

    dualxeon New Member

    I just checked it, and when i request the page i get the following error:

    Code:
    [Mon Feb 18 15:49:27 2008] [error] [client 192.168.1.10] script '/home/admin/sharedip/home' not found or unable to stat
    the errors are very weird:confused:
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Can you post your vhost configuration?
     
  7. dualxeon

    dualxeon New Member

    Sure:
    Code:
    <VirtualHost *:80>
    ServerName localhost
    DocumentRoot /home/admin/sharedip
    Options -Indexes IncludesNoExec
    php_admin_value open_basedir /home/admin/sharedip
    <Directory /home/admin/sharedip>
    allow from all
    </Directory>
    
    # Perl Interpretter Settings
    Action perlfiles "/home/admin/test.cgi "
    AddHandler perlfiles .pl
    
    </VirtualHost>
     
  8. dualxeon

    dualxeon New Member

    Dont worry any more, problem solved, thanks for all your help
     
  9. falko

    falko Super Moderator Howtoforge Staff

    What was the problem?
     
  10. dualxeon

    dualxeon New Member

    You have to set up a script alias first
     

Share This Page