2007-08-08

papaya CMS on Lighttpd

Our current development system is Apache httpd. But it can run on Lighttpd, too. First you need to activate the mod_rewrite and define a set of rewrite rules in the configuration file.
url.rewrite-once = (
# admin pages
"^/?(?:sid[a-z]*(?:[a-zA-Z0-9,-]{32}|[a-zA-Z0-9,-]{40})/)?papaya/module\_([a-z\_]+)\.[a-z]{3,4}(?:\?(.+))?$" => "/papaya/module.php?p_module=$1&$2",
# pages
"^/?(?:sid[a-z]*(?:[a-zA-Z0-9,-]{32}|[a-zA-Z0-9,-]{40})/)?[a-zA-Z0-9_-]+(?:(?:\.[0-9]+)?\.[0-9]+)(?:(?:\.[a-z]{2,5})?\.[a-z]+)(?:(?:\.[0-9]+)?.preview)?(\?.+)?$" => "/index.php$1",
# index page
"^/?(?:sid[a-z]*(?:[a-zA-Z0-9,-]{32}|[a-zA-Z0-9,-]{40})/)?index(?:(?:\.[a-z]{2,5})?\.[a-z]+)(?:(?:\.[0-9]+)?.preview)?(\?.+)?$" => "/index.php$1",
# media files
"^/?(?:sid[a-z]*(?:[a-zA-Z0-9,-]{32}|[a-zA-Z0-9,-]{40})/)?[a-zA-Z0-9_-]+\.(?:media|thumb|download|popup|image)(?:\.(preview))?(?:(?:\.(?:[a-zA-Z0-9_]+))?(?:\.[a-zA-Z0-9_]+))(\?.+)?$" => "/index.php$1",
# sid only
"^/?(?:sid[a-z]*(?:[a-zA-Z0-9,-]{32}|[a-zA-Z0-9,-]{40}))(/.*)(\?.+)?$" => "$1$2"
)
Next you need to define the 404 handler for alias handling:
server.error-handler-404   = "/index.php"
The last step is a little bugfix in ~/papaya/inc.conf.php. Lighttpd sets $_SERVER['PATH_TRANSLATED'], but it is empty. So this check needs a little patch:
if (isset($_SERVER['PATH_TRANSLATED']) && $_SERVER['PATH_TRANSLATED'] != '') {
This way papaya CMS will use $_SERVER['SCRIPT_FILENAME']. We fixed this in the development version already. It will be included in the next public version.

2007-08-06

Last PHPUG Meeting

At the last PHPUG Meeting I talked about file delivery with PHP-Scripts. Here are the slides: PDF

2007-08-02

Optimizing Backend

We are currently optimizing the backend performance. With Firebug we could get all requests for a page and optimize the caching.

First a result with an empty browser cache. It loads about 60 files and takes some time. Because some of the images are module files and can be outside the document root, they need to be send using a php script.

A second click on the same button shows a nice result. Most of the files, including the module images, are cached. Only 13 requests for the page now.

We are still trying to improve that result. But I think it is a good start.
x