# lighttpd + php install how to

## sobers_2002

if some1 could please point me to/write a lighttp with php installation tutorial on gentoo

i would thank you for my life  :Smile: . i really really need to have this working.

thanks a ton

Saurabh

----------

## c4

I switched from apache to lighttpd this weekend on my main server. I'm still learning more about the features with CML, but I can give you some info about php and cgi.

Currently running lighttpd-1.4.7 and dev-lang/php-5.0.5-r4 with hardened patches. Reason for php5? It seemed to have support for for php/cgi without needing additional modules, although I've read posts saying that php4 is faster so choose what is best for your needs.

I have added several packages to my package.keywords list, they might not all be necessary just for enabling php support to lighttpd.

nano -w /etc/portage/package.keywords

```
# Use masked PHP5

dev-lang/php

app-admin/eselect-php

app-admin/eselect

dev-php/PEAR-PEAR

dev-php/PEAR-DB

dev-php/PEAR-Mail

dev-php/PEAR-MDB

dev-php/PEAR-Archive_Tar

dev-php/PEAR-XML_RPC

dev-php/PEAR-Console_Getopt

dev-php5/pecl-pdo

dev-php5/pecl-pdo-mysql

dev-php/smarty

dev-php5/pecl-apc

#

# Get latest lighttpd, memcache for cml support

www-servers/lighttpd

dev-libs/libmemcache

#

```

Relevant info from my current /etc/portage/package.use. Note that I am running a hardened x86 box but I still think that these use-flags are ok. Also, I had problems with fam, so I chose to build lighttpd without it.

```
dev-lang/php            dba cli cgi -apache2 gd jpeg mysql pcre pdo-external pear png session simplexml xml2 xsl zlib

www-servers/lighttpd    bzip2 fastcgi gdbm mysql pcre php ssl -fam lua memcache

```

Test and see is all seems ok with 

```
emerge -pv dev-lang/php lighttpd
```

 If there are erros about masked packages missing, add them to /etc/portage/package.keywords and try again.

That should get you going with lighty, the default configfiles are located in /etc/lighttpd.

As I am not too familiar with Lighttpd myself i can't give you so much information about the configuration, although the configs for cgi and fastcgi are loaded by default. Vhosts are really easy and I have got ssl set agin too.

----------

## sobers_2002

thanks a ton mate!!!

so then after this (i will go with php5 like you) all i need to do is fireup lighttpd and have a php working system??   :Question: 

thanks again for the help  :Very Happy: 

----------

## c4

 *sobers_2002 wrote:*   

> so then after this (i will go with php5 like you) all i need to do is fireup lighttpd and have a php working system??   

 

yep, build lighty with the php use-flag set.. and than it's basically just as simple as /etc/init.d/lighttpd start   :Wink: 

----------

## sobers_2002

thanks a lot!

got a working php + lighttpd system now  :Very Happy: 

----------

