Results 1 to 15 of 30

Thread: lighttp and php tutorial

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    lighttp and php tutorial

    I will do this i quick steps.

    Install Lighttpd:

    ipkg install lighttpd

    Install Fast-CGI

    Code:
    ipkg install php-fcgi
    Then you edit /opt/etc/lighttpd/lighttpd.conf
    (I Use Joe editor so if you havnet install it do it by: "
    Code:
    ipkg install joe
    ")
    Code:
    joe /opt/etc/lighttpd/lighttpd.conf
    now start removing the # from
    Code:
    #                                "mod_fastcgi",

    Change
    server.document-root
    to something like:
    Code:
    server.document-root        = "/opt/share/www/"
    change the accesslog.filename
    to something like:
    #### accesslog module
    Code:
    accesslog.filename          = "/opt/share/www/log/access.log"
    Add ".sqlite" to:
    Code:
    url.access-deny             = ( "~", ".inc",".sqlite" )
    Now the most importent thing is to change the FastCGI setting to this:

    Code:
    fastcgi.server              = ( ".php" =>
                                      ((
                                        "host" => "192.168.1.1",
                                        "port" => 1026,
                                      ))
                                  )
    Hit
    Code:
    ctrl-k-x
    to save and exit

    Next thing is to create the file
    /opt/etc/init.d/S45php

    So you make the file by doing
    Code:
    joe /opt/etc/init.d/S45php
    and you put the following in it:

    Code:
    #!/bin/sh
    
    export PHP_FCGI_CHILDREN=1
    PORT=1026
    BIN=/opt/bin/php-fcgi
    #/opt/etc/php.d
    
    case $1 in
     start)
      $BIN -b $PORT &
      ;;
     stop)
      kill Pidof phpM  ;;
     *)
      echo "usage: $0 (start|stop)"
      exit 1
    esac
    Save and exit: "
    Code:
    Ctrl-k-x
    "

    Change the permission on it to make it executable:
    Code:
    chmod +x S45php
    Now you can start it by:
    Code:
    ./S45php start
    or it will start when you reboot the next time


    Thanks goes to Macsat for helping me to get it working on my unit
    -------------\______/-------------
    ASUS Wl-500W

  2. #2
    Join Date
    Jul 2005
    Location
    Germany
    Posts
    15

    Unhappy Problems with fast-cgi

    Hi theboy50,

    thanks for this tutorial. I tried to get the lighttpd run with php support.
    I did what you've explained in your tutorial, but everytime when I start
    the lighttpd-server, the fast-cgi process was killed.

    Then I tried to start the fast-cgi directly with the lighttpd:

    Code:
    fastcgi.server = (".php" =>
                        ( "localhost" =>
                            (
                                "socket" => "/tmp/php-fastcgi.socket",
                                "bin-path" => "/opt/bin/php-fcgi",
                                "bin-environment" => (
                                "PHP_FCGI_CHILDREN" => "1",
                                "PHP_FCGI_MAX_REQUESTS" => "5000"
                                                     )
                            )
                        )
    )
    ps ax tells my that everything works fine:

    Code:
      168 admin       704 S   /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
      169 admin      1048 D   /opt/bin/php-fcgi
      170 admin      1048 D   /opt/bin/php-fcgi
      171 admin      1048 D   /opt/bin/php-fcgi
      172 admin      1048 D   /opt/bin/php-fcgi
    But after a few seconds ps ax tells me this:

    Code:
      168 admin       624 S   /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
      169 admin           Z   [php-fcgi]
      170 admin           Z   [php-fcgi]
      171 admin           Z   [php-fcgi]
      172 admin           Z   [php-fcgi]
    It seams that the motherprocess died and the child processes form php-fcgi are running as
    zombies.


    When I try to load a php file from the document-root I get the following error-message in the
    error-log-file form the lighttpd:

    Code:
    2006-05-14 11:08:36: (mod_fastcgi.c.1739) connect failed: Connection refused on 
    
    unix:/tmp/php-fastcgi.socket-3
    2006-05-14 11:08:36: (mod_fastcgi.c.2851) backend died, we disable it for a 5 seconds and send the request 
    
    to another backend instead: reconnects: 0 load: 1
    2006-05-14 11:08:36: (mod_fastcgi.c.2624) child signaled: 10
    2006-05-14 11:08:38: (mod_fastcgi.c.2430) unexpected end-of-file (perhaps the fastcgi process died): pid: 
    
    178 socket: unix:/tmp/php-fastcgi.socket-3
    2006-05-14 11:08:38: (mod_fastcgi.c.3172) child signaled: 10
    2006-05-14 11:08:38: (mod_fastcgi.c.3215) response not received, request sent: 862 on socket: 
    
    unix:/tmp/php-fastcgi.socket-3 for /index.php , closing connection
    Any Idea why the fast-cgi process get killed after a few seconds?

    I've installed the following packages, perhaps there is a package which makes trouble with fast-cgi:

    Code:
    Package: bash
    Version: 2.05b-5
    Depends: ncurses
    Status: install user installed
    Architecture: mipsel
    
    Package: bzip2
    Version: 1.0.3-5
    Status: install user installed
    Architecture: mipsel
    
    Package: coreutils
    Version: 5.2.1-9
    Conflicts: busybox-links
    Status: install user installed
    Architecture: mipsel
    
    Package: cron
    Version: 4.1-4
    Status: install user installed
    Architecture: mipsel
    
    Package: ctorrent
    Version: 1.3.4-2
    Depends: libstdc++, openssl
    Status: install user installed
    Architecture: mipsel
    
    Package: esmtp
    Version: 0.5.1-2
    Depends: libesmtp
    Conflicts: postfix
    Status: install user installed
    Architecture: mipsel
    
    Package: expat
    Version: 1.95.8-3
    Status: install ok installed
    Architecture: mipsel
    
    Package: fontconfig
    Version: 2.3.2-1
    Depends: expat, freetype, gconv-modules
    Status: install ok installed
    Architecture: mipsel
    
    Package: freetype
    Version: 2.1.10-1
    Depends: zlib
    Status: install ok installed
    Architecture: mipsel
    
    Package: gconv-modules
    Version: 2.2.5-5
    Status: install ok installed
    Architecture: mipsel
    
    Package: gdbm
    Version: 1.8.3-2
    Status: install ok installed
    Architecture: mipsel
    
    Package: ipkg
    Version: 0.99.149-2
    Status: install user installed
    Essential: yes
    Architecture: mipsel
    
    Package: less
    Version: 394-1
    Depends: ncurses
    Status: install user installed
    Architecture: mipsel
    
    Package: libbt
    Version: 1.05-4
    Depends: libcurl, openssl, zlib
    Status: install user installed
    Architecture: mipsel
    
    Package: libcurl
    Version: 7.15.3-1
    Status: install user installed
    Architecture: mipsel
    
    Package: libdb
    Version: 4.2.52-3
    Status: install user installed
    Architecture: mipsel
    
    Package: libesmtp
    Version: 1.0.4-1
    Status: install user installed
    Architecture: mipsel
    
    Package: libgd
    Version: 2.0.33-2
    Depends: libpng, libjpeg, freetype, fontconfig
    Status: install ok installed
    Architecture: mipsel
    
    Package: libjpeg
    Version: 6b-2
    Status: install ok installed
    Architecture: mipsel
    
    Package: libpng
    Version: 1.2.8-5
    Depends: zlib
    Status: install ok installed
    Architecture: mipsel
    
    Package: libstdc++
    Version: 0.1.12-3
    Depends: libuclibc++
    Status: install ok installed
    Architecture: mipsel
    
    Package: libuclibc++
    Version: 0.1.12-3
    Status: install ok installed
    Architecture: mipsel
    
    Package: libxml2
    Version: 2.6.23-1
    Depends: zlib
    Status: install user installed
    Architecture: mipsel
    
    Package: libxslt
    Version: 1.1.15-5
    Depends: libxml2
    Status: install user installed
    Architecture: mipsel
    
    Package: lighttpd
    Version: 1.4.11-2
    Depends: pcre, zlib
    Suggests: bzip2, libmemcache, lua, memcached, mysql, openldap, openssl
    Status: install user installed
    Architecture: mipsel
    
    Package: lzo
    Version: 1.08-2
    Status: install ok installed
    Architecture: mipsel
    
    Package: mc
    Version: 4.1.35-2
    Depends: ncurses
    Status: install user installed
    Architecture: mipsel
    
    Package: microperl
    Version: 5.8.6-3
    Status: install user installed
    Architecture: mipsel
    
    Package: ncurses
    Version: 5.5-1
    Status: install user installed
    Architecture: mipsel
    
    Package: openssl
    Version: 0.9.7d-4
    Status: install user installed
    Architecture: mipsel
    
    Package: pcre
    Version: 5.0-5
    Status: install ok installed
    Architecture: mipsel
    
    Package: php
    Version: 5.1.4-1
    Depends: bzip2, openssl, zlib, libxml2, libxslt, gdbm, libdb
    Status: install user installed
    Architecture: mipsel
    Conffiles:
    /opt/etc/php.ini 211ce782fa34ea1da50a564a63094fe3
    Installed-Time: 1147542320
    
    Package: php-fcgi
    Version: 5.1.4-1
    Depends: php (5.1.4), pcre
    Status: install user installed
    Architecture: mipsel
    
    Package: php-mysql
    Version: 5.0.3-13
    Depends: php, mysql
    Status: install user not-installed
    Architecture: mipsel
    
    Package: php-mysql
    Version: 5.0.3-12
    Depends: php, mysql
    Status: install user not-installed
    Architecture: mipsel
    
    Package: php-thttpd
    Version: 2.25b-5.0.3-5
    Depends: php
    Conflicts: thttpd
    Status: install user not-installed
    Architecture: mipsel
    
    Package: php-thttpd
    Version: 2.25b-5.1.4-1
    Depends: php (>= 5.0.3-8), libxml2
    Conflicts: thttpd
    Status: install user installed
    Architecture: mipsel
    
    Package: poptop
    Version: 1.2.1-1
    Status: install user installed
    Architecture: mipsel
    
    Package: readline
    Version: 5.0-2
    Status: install ok installed
    Architecture: mipsel
    
    Package: screen
    Version: 4.0.2-2
    Depends: termcap
    Status: install user installed
    Architecture: mipsel
    
    Package: termcap
    Version: 1.3.1-2
    Status: install ok installed
    Architecture: mipsel
    
    Package: torrent
    Version: 1.3-8
    Depends: libbt, coreutils
    Status: install user installed
    Architecture: mipsel
    
    Package: vsftpd
    Version: 2.0.1-7
    Status: install user installed
    Architecture: mipsel
    
    Package: xinetd
    Version: 2.3.13-4
    Status: install user installed
    Architecture: mipsel
    
    Package: zlib
    Version: 1.2.2-2
    Status: install user installed
    Architecture: mipsel
    Thankx.

    Best regards

    mmX

  3. #3

    No..

    I'm sorry. I don't know why that is.
    People are saying that php has ben updated and there are some proplems with it. Meaby thats the reason.
    -------------\______/-------------
    ASUS Wl-500W

  4. #4
    hmm i think i had the same problem a while ago.
    the solution was to change the socket path to a directory within the /opt directory.
    hope this helps you!
    Code:
    "socket" => "/opt/tmp/php-fastcgi.socket"

  5. #5
    Join Date
    Jul 2005
    Location
    Germany
    Posts
    15
    I'd already tried to change the socket-path into the /opt area, but it doesn't help. After a few minutes the fcgi process becomes zombies.

    A also reinstalled all necessary packages.

    Any ideas?

    Thanks.

    mmX

  6. #6
    Ok i did everything as described in the tutorial but lighttpd won't start. What am I doing wrong?? I already tried changing the S80lighttpd config file to what is on the mascat page but this also did not help.

    What do I need to change ???

    Code:
    [NLBADB0Y@WL500g root]$ ps ax
      PID  Uid     VmSize Stat Command
        1 NLBADB0Y    416 S   /sbin/init
        2 NLBADB0Y        SW  [keventd]
        3 NLBADB0Y        RWN [ksoftirqd_CPU0]
        4 NLBADB0Y        SW  [kswapd]
        5 NLBADB0Y        SW  [bdflush]
        6 NLBADB0Y        SW  [kupdated]
        7 NLBADB0Y        SW  [mtdblockd]
       39 NLBADB0Y    276 S   telnetd
       44 NLBADB0Y    452 S   httpd eth1
       48 NLBADB0Y    312 S   syslogd -m 0 -O /tmp/syslog.log -S -l 7
       49 NLBADB0Y    288 S   klogd
       52 nobody      380 S   dnsmasq
       54 NLBADB0Y    248 S   nas /tmp/nas.lan.conf /tmp/nas.lan.pid lan
       57 NLBADB0Y        SW  [khubd]
       67 NLBADB0Y    184 S   lpd
       69 NLBADB0Y    188 S   p9100d -f /dev/usb/lp0 0
       71 NLBADB0Y    188 S   p9101d -f /dev/printers/0 1
       74 NLBADB0Y    240 S   waveservermain
       78 NLBADB0Y        SW  [usb-storage-0]
       79 NLBADB0Y        SW  [scsi_eh_0]
       84 NLBADB0Y    280 S   infosvr br0
       85 NLBADB0Y    428 S   watchdog
       89 NLBADB0Y    268 S   ntp
       95 NLBADB0Y        SW  [kjournald]
      102 NLBADB0Y   4116 S   /opt/bin/php-fcgi -b 1026
      120 NLBADB0Y    356 S   udhcpc -i eth1 -p /var/run/udhcpc0.pid -s /tmp/udhcpc
      126 NLBADB0Y   4208 S   /opt/bin/php-fcgi -b 1026
      132 NLBADB0Y    496 S   upnp -D -L br0 -W eth1
      134 NLBADB0Y    528 S   -sh
      137 NLBADB0Y    388 R   ps ax
    [NLBADB0Y@WL500g root]$
    Last edited by NLBADB0Y; 25-06-2006 at 14:49.

  7. #7

    lib-gd giving problems?

    I see that you have libgd installed. It kills my thttpd server (actually anything that works with libgd) So if you have your scripts accessing libgd that might be the problem (firmware 7e)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •