Lighttpd Web Server with PHP Support through Optware-NG

1 - Install Optware-NG from here

2 - Update optware-ng

ipkg update
ipkg upgrade

3 - Install lighttpd

ipkg install lighttpd

4 - Change server port from 8081 to 81

sed -i 's/server.port                = 8081/server.port                = 81/g' "/opt/etc/lighttpd/lighttpd.conf"

5 - Start server

/opt/etc/init.d/S80lighttpd restart

6 - Go to 192.168.1.1:81 and if you see this page, the lighttpd web server is configured correctly

7 - Create php info page

cat >> /opt/share/www/info.php << EOF
<?php
phpinfo();
?>
EOF

Press ENTER

8 - Install PHP

ipkg install php php-fcgi

9 - Restart server

/opt/etc/init.d/S80lighttpd restart

10 - Go to 192.168.1.1:81/info.php and if you see this page, php is configured correctly

11 - Enable access from wan

nano /jffs/scripts/firewall-start

Paste this lines

#!/bin/sh
iptables -I INPUT -p tcp --destination-port 81 -j ACCEPT
Save with CTRL-O / Enter / and exit with CTRL-X
Make script executable and apply rule
chmod a+rx /jffs/scripts/firewall-start
/jffs/scripts/firewall-start

12 - Go to Port Forwarding page http://192.168.1.1/Advanced_VirtualServer_Content.asp and redirect port 80 to 81

lighttpd-portfw

Enjoy...

  • Tanaka

    Step. 10 in http://192.168.1.1:81/info.php page, I got "500 - Internal Server Error"

    • Clear cookies, reboot router and/or use another browser.

  • Mario

    mysql php not contain sqlite.so only contain pdo_sqlite.so and sqlitei.pdo

  • Yoric

    Where can I get libsasl2.so.2?

    2016-07-09 19:02:20: (log.c.166) server started
    2016-07-09 19:02:20: (mod_fastcgi.c.1103) the fastcgi-backend /opt/bin/php-fcgi failed to start:
    2016-07-09 19:02:20: (mod_fastcgi.c.1107) child exited with status 16 /opt/bin/php-fcgi
    2016-07-09 19:02:20: (mod_fastcgi.c.1110) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
    If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
    2016-07-09 19:02:20: (mod_fastcgi.c.1397) [ERROR]: spawning fcgi failed.
    2016-07-09 19:02:20: (server.c.964) Configuration of plugins failed. Going down.

    php-fcgi -v
    /tmp/mnt/Photo/optware-ng/bin/php-fcgi: can't load library 'libsasl2.so.2'

    ldd php-fcgi
    libdl.so.1 => /opt/lib/libdl.so.1 (0x2aac0000)
    libpthread.so.1 => /opt/lib/libpthread.so.1 (0x2aad4000)
    libgcc_s.so.1 => /opt/lib/libgcc_s.so.1 (0x2aafc000)
    libcrypt.so.1 => /opt/lib/libcrypt.so.1 (0x2ab35000)
    libstdc++.so.6 => /opt/lib/libstdc++.so.6 (0x2ab59000)
    libm.so.1 => /opt/lib/libm.so.1 (0x2aca8000)
    libsasl2.so.2 => not found
    libxml2.so.2 => /opt/lib/libxml2.so.2 (0x2acd6000)
    libz.so.1 => /opt/lib/libz.so.1 (0x2ae41000)
    libiconv.so.2 => /opt/lib/libiconv.so.2 (0x2ae69000)
    libc.so.1 => /opt/lib/libc.so.1 (0x2af59000)
    ld-uClibc.so.1 => /opt/lib/ld-uClibc.so.1 (0x2aaa8000)

    ipkg install lighttpd
    Package lighttpd (1.4.32-1) installed in /opt/ is up to date.

    ipkg install php php-fcgi
    Package php (5.6.19-1) installed in /opt/ is up to date.
    Package php-fcgi (5.6.19-1) installed in /opt/ is up to date.

    • Yoric

      Fixed.
      /lib# ln -s libsasl2.so.3 libsasl2.so.2

  • Incognito Psytrancer

    Pleace help!!! optware-ng.arm/bin/motion: can't load library 'libmysqlclient.so.14' !!!

    • Incognito Psytrancer

      SOLVED run motion:

      lib/ ln -s libmysqlclient.so.libmysqlclient.so.20.0.9 libmysqlclient.so.14

      ipkg install xz-utils

SUBSCRIBE

To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...