Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default err 404 cant run cgi-bin

    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. #2
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by power_on
    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

    I'VE CHECKED THE FILES PERMISSIONS and it is 755.
    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
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  3. #3
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default uid and GID

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


    Any new ideas....

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by power_on
    I've checked the ownership of the files and it is ok ..
    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.
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  5. #5
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default 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. #6
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by power_on
    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,
    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!!!
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  7. #7
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default 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. #8
    Member
    Join Date
    Feb 2004
    Posts
    469

    Default

    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. #9
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default 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. #10
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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!";
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  11. #11
    Member linux-image's Avatar
    Join Date
    Jun 2004
    Location
    India
    Posts
    1,185
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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.

Similar Threads & Tags
Similar threads

  1. How can a user run a .cgi script outside the cgi-bin?
    By BianchiDude in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-24-2009, 09:16 AM
  2. run a file from the cgi-bin folder
    By tonyevans in forum New User Questions
    Replies: 1
    Last Post: 04-21-2008, 08:28 AM
  3. cgi-bin always has 404 error.
    By DWHS.net in forum cPanel and WHM Discussions
    Replies: 20
    Last Post: 11-30-2005, 09:12 PM
  4. cgi-bin's appear as 404's ?
    By Steven_K in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-08-2003, 01:14 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube