cannot execute helloworld CGI after installation

Discussion in 'Install/Configuration' started by _harri_, Feb 18, 2004.

  1. _harri_

    _harri_ New Member

    hi!

    i´ve just finished the installation of litespeed and i have some problems:
    when i want to start the helloworld script on the demopage, nothing happens. the same thing in the admin-space: when i click on a "edit"-link, a new window pops up, but there is no content.

    these messages are from the server-log:
    2004-02-18 21:56:29.376
    INFO
    Start FCGI [phpFcgi]: failed to bind to uds://tmp/lshttpd/php.sock, fast cgi might be running,
    2004-02-18 22:03:06.384
    INFO
    Start FCGI [fcgiAdminPHP]: failed to bind to UDS://tmp/lshttpd/admin_php.sock, fast cgi might be running,

    this is one of the many errors in /opt/lsws/logs/stderr.log after browsing the admin-space:

    PHP Warning: Unknown(): open(/tmp/sess_a38ee2b0cfe006ff4d3da9ef2ad02ea3, O_RDWR) failed: Permission denied (13) in Unknown on line 0
    PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
    PHP Warning: session_start(): open(/tmp/sess_a38ee2b0cfe006ff4d3da9ef2ad02ea3, O_RDWR) failed: Permission denied (13) in /opt/lsws/admin/html/admin/authHeader.php on line 6

    the tmp directory is mounted with the following parameters:
    /dev/sda7 on /tmp type ext3 (rw,nodev,noatime)

    it looks like a problem with the rights and i dont know anyway how to solve it...
    can you tell me what lib´s and programs should be installed before using litespeed? i run lsws on a gentoo-linux machine and there is nothing preinstalled.


    thx for helping!
    _harri_
  2. mistwang

    mistwang LiteSpeed Staff

    Thank you for trying our product.
    looks like your /dev/sda7 is full, make sure there are enough free space left. Make sure the user who the web server running as can write to /tmp/.
  3. _harri_

    _harri_ New Member

    thx! parts of the problem are now solved; after chmod -R 0777 /tmp , the admin-space works!

    but the problem with the helloworld script still exists...
    i`ll keep on trying to get it working. when everything is solved, i´ll post my expieriences with litespeed ;)
  4. mistwang

    mistwang LiteSpeed Staff

    I could not think of any thing that could cause helloworld script stop working.
    Please turn on the debug log by changing "Debug level" to "high", and check lsws/logs/error.log or just use the log viewer, see if you can figure some thing out.
    Please send the debug log to bug@litespeedtech.com if necessory.

    Thanks.
  5. _harri_

    _harri_ New Member

    this is the part of the log after clicking on the helloworld link in the browser

    Method=[GET], URI=[/cgi-bin/helloworld],
    QueryString=[]
    Content Length=0
    2004-02-22 14:24:40.453 [DEBUG] [192.168.0.7:2131-0] HttpIOLink::suspendRead()...
    2004-02-22 14:24:40.453 [DEBUG] [192.168.0.7:2131-0] run cgi processor.
    2004-02-22 14:24:40.459 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] CGI process pid=3485!
    2004-02-22 14:24:40.459 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] request header is done
    2004-02-22 14:24:40.459 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] Request body done!
    2004-02-22 14:24:40.468 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] CgiConnection::eek:nRead()
    2004-02-22 14:24:40.468 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] [EXT] EndResponse( endCode=0, protocolStatus=0 )
    2004-02-22 14:24:40.468 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] release ExtProcessor!
    2004-02-22 14:24:40.469 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] HttpIOLink::continueWrite()...
    2004-02-22 14:24:40.469 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] write resumed!
    2004-02-22 14:24:40.469 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] HttpIOLink::handleEvents() events=4!
    2004-02-22 14:24:40.469 [DEBUG] [192.168.0.7:2131-0:cgi:cgi] HttpIOLink::suspendWrite()...
    2004-02-22 14:24:41.288 [DEBUG] [192.168.0.7:2130-6:cgi:cgi] Close socket ...




    this line was added in stderr.log after the click:
    /opt/lsws/DEFAULT/cgi-bin/helloworld: line 5: cannot create temp file for here document: Permission denied


    where does the script want to create a temp file?
  6. mistwang

    mistwang LiteSpeed Staff

    Looks like some thing wrong with the CGI written in shell scipt.
    Please try the CGI script on command line as "root" user and the user who the web server process is running as.

    Code:
    cd lsws/DEFAULT/cgi-bin/
    ./helloworld
    sudo -u <username> ./helloworld
    
    I think the last command will fail and produce the same output as the line in stderr.log, you need to figure out why the shell script does not work, maybe it is just a permission issue.
  7. _harri_

    _harri_ New Member

    thx, i´ll try to find the error and post my solution when it works!
  8. _harri_

    _harri_ New Member

    when i start the helloworld with user root in a shell, then it works.
    when i start with sudo -u webserver ./helloworld in a shell, the error appears.

    after that i set the writing permissions for tmp:
    chmod 0777 /tmp
    now sudo -u webserver ./helloworld worked fine in the shell, but not in the browser.
    what else should i change?
  9. mistwang

    mistwang LiteSpeed Staff

    The previous result might be cached by the browser, just restart the web server, do a no-cache refresh from your browser (press "shift" or "ctrl" key) when you click the refresh button.
    Should work now.
  10. _harri_

    _harri_ New Member

    something changed! the "permission denied" error disappeared, but a new error was created.
    this is from /opt/lsws/logs/stderr.log:
    /var/web/DEFAULT/cgi-bin/helloworld: fork: Resource temporarily unavailable


    but with sudo, the script was correctly executed ?!
  11. mistwang

    mistwang LiteSpeed Staff

    Are you running other daemon server like Apache with user name webserver? You need to increase the resouce limit for CGI from web admin interface, under server's "security" tab, set "Process Soft/Hard Limit" to higher than the total number of processes running as "webserver".
  12. _harri_

    _harri_ New Member

    it works! i set the process hard/soft limit to 0, and the problem was solved.
  13. mistwang

    mistwang LiteSpeed Staff

    Yes, litespeed web server will use the system default limit if it is set to 0.
    Have fun. :)

Share This Page