The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

err 404 cant run cgi-bin

Discussion in 'General Discussion' started by power_on, Jan 8, 2006.

  1. power_on

    power_on Member

    Joined:
    Aug 10, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello

    I cant run cgi-bin scripts in the cgi-bin dir in the public_html

    I've checked the suexec err log and it says

    [2006-01-08 11:06:26]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi
    [2006-01-08 11:14:43]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi
    [2006-01-08 11:17:48]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi


    i think it is normal entries

    I'VE CHECKED THE FILES PERMISSIONS and it is 755.
    I've checked the virtual host entries and it is ok ,here it is:

    <VirtualHost 98.55.145.66>
    ServerAlias www.hostingarabs.com hostingarabs.com
    ServerAdmin webmaster@hostingarabs.com
    DocumentRoot /home/vhosts/hosting/public_html
    BytesLog domlogs/hostingarabs.com-bytes_log
    User hosting
    Group hosting
    <IfModule mod_php4.c>
    php_admin_value open_basedir "/home/vhosts/hosting/:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule mod_php5.c>
    php_admin_value open_basedir "/home/vhosts/hosting/:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    ServerName www.hostingarabs.com
    <IfModule mod_userdir.c>
    Userdir disabled
    Userdir enabled hosting
    </IfModule>
    User hosting
    group hosting
    CustomLog domlogs/hostingarabs.com combined
    ScriptAlias /cgi-bin/ /home/vhosts/hosting/public_html/cgi-bin/
    </VirtualHost>


    I also have checked the cgi option in whm settings and it is "y".

    Plz help me....

    Any new Ideas.


    Thank you and Best Regards...
     
  2. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    The error message is self explanatory, and it's telling you exactly what the problem is. Suexec will only run a script if all the security checks.Make sure the cgi/perl scripts are owned by the user's uid and gid (user and group).

    It is very possible that the script is failing to run via the cgi interface, because the script is not owned by its user and group. The script would also fail without the proper header. Also, make sure the script is in the correct web root path.

    There is a cPanel script you can run at the prompt: /scripts/fixsuexeccgiscripts
     
  3. power_on

    power_on Member

    Joined:
    Aug 10, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    uid and GID

    I've checked the ownership of the files and it is ok ..


    Any new ideas....
     
  4. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    Is this the only script with the problem? Are you sure that perl runs on your server?
    What happens if you run the Hello World script at the prompt:

    Code:
    #!/usr/bin/perl
    print "Hello World\n";
    Although I don't like this, but you can enable and then re-enable Suexec.
     
  5. power_on

    power_on Member

    Joined:
    Aug 10, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    The perl works

    Tthe perl scrip is working from shell very good,

    tried to put it in the cgi-bin directory

    but it doesnt work from the browser,

    I also tried another user account but it didnt work.

    I disabled and re-enabled the suexec but it didn't work...

    Any others Ideas...
     
  6. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    Did you check the log files to see if you get the same error message(s) when runing the "Hello World" script? Place the cgi script in a different directory other than the cgi-bin directory, and see if it works. What's the URL to the script? It could be your browser/PC!!!
     
  7. power_on

    power_on Member

    Joined:
    Aug 10, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    The same

    The suexec log gives this

    [2006-01-08 11:45:48]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: test.pl

    and the http error_log gives this

    [Sun Jan 8 14:21:21 2006] [error] [client 82.201.169.18] Premature end of script headers: /home/vhosts/hosting/public_html/cgi-bin/test.pl
    [Sun Jan 8 14:21:21 2006] [error] [client 82.201.169.18] File does not exist: /home/vhosts/hosting/public_html/500.shtml


    thanx
     
  8. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
    There is another thing you can try now we see the above error message. It is a very common error message and may be caused by creating the file in a windows editor like notepad and not uploading in unix ASCII format.

    From shell you can use pico:
    cd /directory/of/test.pl
    pico test.pl

    I also did a Google for "Premature end of script headers" include the " " which gave some useful info about this error and more options you can try.

    :)
     
  9. power_on

    power_on Member

    Joined:
    Aug 10, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Problem solved

    The problem have been solved......

    The problem was a permission problem but not in
    cgi-bin dir or files in it :)

    it was in the perl executable

    /usr/bin/perl it was 754 and it ishoud be 755

    #chmod 755 /usr/bin/perl

    Thankk you for your support


    Yahia.Salah
     
  10. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Just incase anyone else comes across this thread in the future, that hello world test script will never work as a CGI script anyway. It should be like this:
    Code:
    #!/usr/bin/perl
    print "content-type: text/html\n\n";
    print "Hello World!";
    
     
  11. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    to add, the error can also happen in case the path of the perl given on the script is wrong.

    it is always good to check on the path by a

    #which perl

    command and use the same.
     
Loading...

Share This Page