Howto install a webserver, php and mysql

Please put your howto's and guides here

Howto install a webserver, php and mysql

Postby Bryan » 01 Aug 2006 14:01

Current version: 0.1.9 (23 September 2006)
I know many have longed for a webserver, php and mysql for their msses, and finally their longing has come to an end. In this tutorial I will show how to install and and configure lighttpd-1.4.11, php-5.1.4 and mysql-5.0.22

Requirements
This tutorial assumes you have OpenMSS and BusyBox installed. For the latter one, issue ipkg install busybox on the commandline.

Furthermore, you must add a new repository to your ipkg list:
Code: Select all
cat >> /opt/etc/ipkg.conf
src bryan http://ipkg.openmss.org/bryan
{Press: ctrl+d}

Then, install a new version of libc6 if you have not done yet before:
Code: Select all
ipkg install libc6


For editting config files, vi is commonly used. Open a file by vi /path/to/file. Enter editmode by entering i. When your done, press escape twice, and type :wq<enter>.

lighttpd
As Apache is much to overweight for our 32MB MSS, I decided to use lighttpd, which is a webserver with the capabilities of Apache, but a much smaller memory usage.

1. Install lighttpd
Code: Select all
ipkg install lighttpd


2. Configure lighttpd: lighttpd defaults to running at port 8080, with /opt/bin/lighttpd/var/wwwroot as it's root directory, but you can change that by editting /opt/bin/lighttpd/lighttpd.conf.
For PHP support add or change the following lines in /opt/bin/lighttpd/lighttpd.conf:

Code: Select all
static-file.exclude-extensions = ( ".php" )
index-file.names = ( "index.html", "index.php" )

server.modules = ("mod_fastcgi", )

fastcgi.server = (
    ".php" => ((
        "bin-path" => "/opt/bin/php",
        "socket" => "/opt/bin/lighttpd/php.socket",
        "max-procs" => 2,
        "bin-environment" => (
            "PHP_FCGI_CHILDREN" => "4",
            "PHP_FCGI_MAX_REQUESTS" => "32"
        ),
        "bin-copy-environment" => ( "PATH", "SHELL", "USER"),
        "broken-scriptfilename" => "enable"
    ))
)


PHP
PHP Hypertext Processor is a commonly used scripting languages for websites, and now also available for OpenMSS.

1. Install PHP
Code: Select all
ipkg install libxml2
ipkg install php5

2. If you want to modify the default PHP settings, you may create /opt/etc/php.ini

3. If you are running Firmware 1.2.2, you might need a new version of libpthread.
Code: Select all
ipkg install http://ipkg.openmss.org/testing/libpthread_0.9_mipsel.ipk


MySQL
MySQL is a commonly used database system, with bindings to PHP.

1. Install MySQL (note: this may take a while to download and install)
Code: Select all
ipkg install mysql

2. If you want to modify the default MySQL settings, the config file is located at /opt/usr/local/mysql/etc/my.cnf

Testing
1. Create a phpinfo.php file:
Code: Select all
cat > /opt/bin/lighttpd/var/wwwroot/phpinfo.php
<?php phpinfo(); ?>
{Press: ctrl+d}


2. Start lighttpd:
Code: Select all
/opt/bin/lighttpd/bin/lighttpd


3. Surf to http://address-of-your-mss:8080/phpinfo.php

Any mistakes in either this tutorial or one of my packages? Feel free to comment!
Last edited by Bryan on 23 Sep 2006 20:16, edited 13 times in total.
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby Bryan » 01 Aug 2006 14:02

Temporary Solution
If it is not working, you might be missing some libraries. Issue the following commands to solve the problems:

Code: Select all
cd /tmp
wget http://home.casema.nl/openmss/php-support.tar.gz
gunzip php-support.tar.gz
cd /opt/lib
tar xvf /tmp/php-support.tar


It should be working by now...
Last edited by Bryan on 26 Aug 2006 20:56, edited 3 times in total.
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby Bryan » 01 Aug 2006 14:02

(reserved, slot for later use)
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby vwgtiturbo » 03 Aug 2006 21:43

Wow, you must have been reading my mind. I have been looking for this for MONTHS, but with so little time, and lack of knowledge, never could get it together. If this works, you are going to be my hero.
vwgtiturbo
Junior Member
 
Posts: 5
Joined: 03 Nov 2005 23:06
Location: California

Postby raskal » 04 Aug 2006 05:41

Everything installed fine, however when it comes to the last step (getting lighttpd running), I get the following:

# /opt/bin/lighttpd/bin/lighttpd
/opt/bin/lighttpd/bin/lighttpd.ld: not found


Any ideas?
raskal
Junior Member
 
Posts: 6
Joined: 28 Jul 2006 06:23

Postby raskal » 04 Aug 2006 06:09

Fixed my problem by copying the hndtools (v3.2.3 -- v3.0 didn't work) libs into /opt/lib. In particular, the following were required:

/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/ld*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libm*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libpthread*
raskal
Junior Member
 
Posts: 6
Joined: 28 Jul 2006 06:23

Postby Bryan » 04 Aug 2006 10:59

Yeah, I created a symlink to /opt/lib/ld.so.1, which I unfortunately forgot to copy ;) I will be uploading a new version today.
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby Bryan » 05 Aug 2006 21:05

They have been updated :D
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby MPR » 06 Aug 2006 01:07

thanks bryan,

lighttpd running now, but php dont work -> missing libpthread.so.0

/opt/lib/php5/bin/php5: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
MPR
Newbie
 
Posts: 2
Joined: 06 Aug 2006 01:03

Postby Bryan » 07 Aug 2006 21:46

Ok, thanks... I will have a good look at ldd and submit a new version.
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby Bryan » 07 Aug 2006 22:17

Strange, libpthread seems to be in /lib, in cramfs. Which version of openmss are you running MPR?
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby max » 12 Aug 2006 15:23

raskal wrote:Fixed my problem by copying the hndtools (v3.2.3 -- v3.0 didn't work) libs into /opt/lib. In particular, the following were required:

/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/ld*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libm*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libpthread*


I've got exactly the same problem. Where did you get these files? I searched through OpenMSS.org and could only find v3.0
Did you compile them? I don't have a linux plateform at hand and would be quite interested by binaries. Can you post them somewhere?

Thanks.


BTW I run a mss122_openmss3-rc1 if someone can help.
max
Junior Member
 
Posts: 16
Joined: 12 Aug 2006 15:12
Location: Lyon, France

Postby max » 12 Aug 2006 16:00

max wrote:
raskal wrote:Fixed my problem by copying the hndtools (v3.2.3 -- v3.0 didn't work) libs into /opt/lib. In particular, the following were required:

/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/ld*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libm*
/opt/brcm/hndtools-mipsel-linux/mipsel-linux/lib/libpthread*


I've got exactly the same problem. Where did you get these files? I searched through OpenMSS.org and could only find v3.0
Did you compile them? I don't have a linux plateform at hand and would be quite interested by binaries. Can you post them somewhere?

Thanks.


BTW I run a mss122_openmss3-rc1 if someone can help.



Sorry I finally got it right: I was desperating since I gave it a few hours.
Well if any newbie like me is interested and has the same problem, follow the instructions from Bryan above, then:
1/ Get hndtools v3.2 from http://www.belkin.com/support/gpl/hnd-tools-3.2.3.m.tgz
2/ Unzip and copy the content of the "hnd-tools-3.2.3.m.tgz\hndtools-mipsel-linux-3.2.3\mipsel-linux\lib" folder into the Public share of your MSS (not the subfolders, that's not needed)
3/ copy the /shares/mss-hdd/Public/ld* and /shares/mss-hdd/Public/libm* and /shares/mss-hdd/Public/libpthread* into /opt/lib
For new-new-newbies, that'll make:
Code: Select all
cp /shares/mss-hdd/Public/ld* /opt/lib
cp /shares/mss-hdd/Public/libm* /opt/lib
cp /shares/mss-hdd/Public/libpthread* /opt/lib


Bryan, do you a have the time (and will!) to make a package which includes the missing libs?
max
Junior Member
 
Posts: 16
Joined: 12 Aug 2006 15:12
Location: Lyon, France

Postby Bryan » 12 Aug 2006 18:38

max wrote:Bryan, do you a have the time (and will!) to make a package which includes the missing libs?

Yes, I will do that, but if it is not yet done tonight, it will be in two weeks as I am going on vacation.

edit: I will not be able to do this tonight. My dev environment is a VMWare Virtual Machine, and my license expired a few days ago. I will have to renew that license, but I am probably not doing that today.

edit2: I have put up a simple solution, for the time being until I am able to build new packages.

@max, could you do me a favor by posting the contents of your /lib directory?

Code: Select all
ls -al /lib/


Thanks, Bryan
Python 2.5, CTorrent dnh3.2, Busybox 1.2.0
Bryan
Senior Member
 
Posts: 125
Joined: 16 Jun 2006 16:50

Postby max » 13 Aug 2006 09:19

Sorry for so late an answer: I guess you're on vacation now.

content of my /lib:
Code: Select all
-rwxr-xr-x    1 root     root       140264 Dec 31  1969 ld.so.1
lrwxrwxrwx    1 root     root           11 Aug 13 00:18 libacl.so -> libacl.so.1
lrwxrwxrwx    1 root     root           15 Dec 13  2003 libacl.so.1 -> libacl.so.1.1.0
-rw-r--r--    1 root     root        57704 Dec 31  1969 libacl.so.1.1.0
lrwxrwxrwx    1 root     root           12 Dec 13  2003 libattr.so -> libattr.so.1
lrwxrwxrwx    1 root     root           16 Dec 13  2003 libattr.so.1 -> libattr.so.1.1.0
-rw-r--r--    1 root     root        21532 Dec 31  1969 libattr.so.1.1.0
-rwxr-xr-x    1 root     root      1605620 Dec 31  1969 libbigballofmud.so
lrwxrwxrwx    1 root     root           18 Dec 13  2003 libbigballofmud.so.0 -> libbigballofmud.so
-rwxr-xr-x    1 root     root      1060456 Dec 31  1969 libc.so.6
-rwxr-xr-x    1 root     root        29624 Dec 31  1969 libcrypt.so.1
-rwxr-xr-x    1 root     root        15460 Dec 31  1969 libdl.so.2
-rwxr-xr-x    1 root     root        45128 Dec 31  1969 libgcc_s.so.0
-rwxr-xr-x    1 root     root       612960 Dec 13  2003 libm.so.6
-rwxr-xr-x    1 root     root       118828 Dec 31  1969 libnsl.so.1
-rwxr-xr-x    1 root     root        19416 Dec 13  2003 libnss_dns.so.2
-rwxr-xr-x    1 root     root        66704 Dec 31  1969 libnss_files.so.2
-rwxr-xr-x    1 root     root       118732 Dec 31  1969 libpthread.so.0
-rwxr-xr-x    1 root     root        91164 Dec 13  2003 libresolv.so.2
drwxr-xr-x    1 60018    100            20 Dec 13  2003 modules


To be complete I also post the content of my /opt/lib (the one I modified directly as described in my first post)
Code: Select all
drwxr-xr-x    4 root     root          776 Aug 12 08:17 .
drwxr-xr-x    8 root     root          192 Jul 31 11:05 ..
drwxr-xr-x    4 root     root          120 Aug 12 08:28 ipkg
-rwxr--r--    1 root     root       949465 Aug 12 08:06 ld-2.2.3.so
-rwxr--r--    1 root     root       653091 Aug 12 08:06 ld-2.2.5.so
-rwxr-xr-x    1 root     root       653091 Aug  4 01:42 ld.so.1
-rwxr-xr-x    1 root     root     10874754 Jul 26 07:14 libc-2.2.5.so
lrwxrwxrwx    1 root     root           13 Aug 12 08:05 libc.so.6 -> libc-2.2.5.so
-rwxr--r--    1 root     root      1993324 Aug 12 08:06 libm-2.2.3.so
-rwxr--r--    1 root     root      1617323 Aug 12 08:06 libm-2.2.5.so
-rwxr--r--    1 root     root      3193310 Aug 12 08:07 libm.a
-rwxr--r--    1 root     root      1617323 Aug 12 08:07 libm.so
-rwxr--r--    1 root     root      1617323 Aug 12 08:07 libm.so.6
-rwxr--r--    1 root     root      3218440 Aug 12 08:07 libm_p.a
-rwxr--r--    1 root     root         3904 Aug 12 08:07 libmcheck.a
-rwxr--r--    1 root     root        48542 Aug 12 08:07 libmemusage.so
-rwxr--r--    1 root     root       785351 Aug 12 08:07 libpthread-0.9.so
-rwxr--r--    1 root     root      1556372 Aug 12 08:07 libpthread.a
-rwxr--r--    1 root     root       785351 Aug 12 08:07 libpthread.so
-rwxr--r--    1 root     root       785351 Aug 12 08:07 libpthread.so.0
-rwxr--r--    1 root     root      1568296 Aug 12 08:07 libpthread_p.a
-rw-r--r--    1 root     root      6898120 Jul 29 12:22 libxml2.a
-rwxr-xr-x    1 root     root          807 Jul 29 12:22 libxml2.la
-rwxr-xr-x    1 root     root      4072691 Jul 29 12:22 libxml2.so
lrwxrwxrwx    1 root     root           10 Aug 12 08:15 libxml2.so.2 -> libxml2.so
drwxr-xr-x    6 root     root          144 Aug 12 08:17 php5
max
Junior Member
 
Posts: 16
Joined: 12 Aug 2006 15:12
Location: Lyon, France

Next

Return to Guides

Who is online

Users browsing this forum: No registered users and 0 guests

cron