Setting Up Lighttpd with PHP

From Alpine Linux
Jump to: navigation, search

To setup lighttpd to use PHP, simply follow the instruction on the Setting Up Lighttpd With FastCGI wiki page.

You will then need a simple test page to prove that PHP is working. Assuming you are using the default directory of /var/www/localhost/htdocs/ for serving pages, create a test page:

echo "<?php phpinfo(); ?>" > /var/www/localhost/htdocs/index.php

Note the page must have the file extension '.php' or it will not be treated as PHP. This is a simple yet very common (and infuriating) mistake to make!

Now test the page by opening your browser and requesting the index.php page, you should see an extensive page featuring a lot of PHP related information. This page should not, of course, be used in production but merely for testing.

See also