Archive for November, 2006

LightTPD mit mod_cml und mod_magnet

Thursday, November 30th, 2006

Kleine Gedankenstütze für mich:

Sowohl ‘mod_cml’ als auch ‘mod_magnet’ in LightTPD >= 1.4.13 benötigen Lua 5.1. Falls Lua 5.1 nicht in der Linux Distribution enthalten ist oder z.b. auch unter Mac OSX, bekommt man Lighty folgendermassen compiliert (vorausgesetzt lua wurde compiliert und unter /usr/local/ installiert):


$ export LUA_CFLAGS="-I/usr/local/include"
$ export LUA_LIBS=”-L/usr/local/lib -llua”
$ ./configure –prefix=/usr –with-pcre –with-lua
$ make

ASP.NET Graphs: Raise the Bar

Wednesday, November 29th, 2006

If you use static images to present graphs and charts online, now’s the time to make your efforts more dynamic. In this results-focused tutorial, Pat explains how easy .NET makes the dynamic generation and display of bar charts online.

In praise of Zend Core

Tuesday, November 28th, 2006

Hi I’m back. Been busy. I will try to relate some of my experiences in the last few months in later blogs.

I’d like to point out that one of the greatest services to the PHP community that Zend is providing is the free Zend Core for Oracle and Zend Core for DB2. The latest versions install PHP 5.1.6. The little known secret is that these 2 installers are perfect for MySQL as the mysql and mysqli extensions are included in the release.

Zend Core is the installer I would recommend to setup PHP in a Windows IIS environment because it has support for FastCGI with IIS. FastCGI is the only scalable and safe way of running PHP on IIS, because not all PHP extensions are thread-safe and there are global locks in multi-threaded mode that hurt PHP performance if don’t use FastCGI.

The only minuses is that Zend Core currently doesn’t include the postgresql extension, and you have to compile in extensions which are not included in the release.

Google Summer of Code: php.net students

Sunday, November 26th, 2006

The PHP team is once again proud to participate in the Google Summer of Code. Ten students will “flip bits instead of burgers” this summer: Zend LLVM Extension by JoonasGovenius, mentored by NunoLopes PHP Optimizer by SamuelGraham Kelly IV, mentored by DerickRethans PhD Improvements and Updates by NicholasSloan, mentored by HannesMagnusson Replace auto* with CMake by Alejandro LeivaRojas, mentored by Pierre A.Joye gsoc:2008 - XDebug by Chung-YangLee, mentored by DavidCoallier Rewrite the run-tests.php script by CesarMontedonico, mentored by TravisSwicegood PHP Bindings for Cairo by AkshatGupta, mentored by AnantNarayanan Algorithm Optimizations by MichalDziemianko, mentored by ScottMacVicar PECL, Website Improvements by BarryCarlyon, mentored by Helgi ÞormarÞorbjörnsson Implement Unicode into PHP 6 by Henrique do NascimentoAngelo, mentored by ScottMacVicar

(PHP) Entwicklungsumgebung unter Windows

Friday, November 24th, 2006

Mein eigenes PHP Framework, das ich für all meine (privaten) Web Anwendungen verwende, benötigt für einige lokale Tools sowie für Build und Deploy Prozesse unter Unix übliche Tools, wie die Bash, GNU Make, awk, sed und wie sie denn alle heissen. Ausserdem mache ich Gebrauch von einigen Eigenheiten des Dateisystems, wie symbolische Links, wie sie so nicht im Windows Dateisystem implementiert sind, bzw. nur umständlich erreicht werden können. Ausserdem setzt mein Framework LightTPD als Web Server voraus, da ich einige spezielle Module dieses hervorragenden Web Servers gerne verwende.

Nun haben aber nicht alle, die dieses Framework verwenden müssen Linux, Mac OS X oder ein anderes Betriebssystem, bei dem von Haus aus all diese schönen Dinge vorhanden sind. Nein, es gibt in der Tat noch Leute, die ein Windows bevorzugen und für die muss eine vernünftige Lösung her.

Nach einigem Überlegen bin ich auf die Idee gekommen, mein Setup unter Cygwin auszuprobieren. Cygwin ist eine Emulation der Linux API für Windows, die es - kurz gesagt - ermöglicht z.b. Linux Anwendungen auf Windows zu portieren. Mehr dazu bei Wikipedia. Cygwin bringt auch eine portierte Bash mit.

Nach Herunterladen der Distribution von der Cygwin Web Seite und der Installation von Cygwin inkl. der Entwicklungstools, war also das Fundament vorhanden. Wer mit einer Debian basierte Linux Distribution vertraut ist, wird das praktische ‘apt-get’ Tool kennen, mit dem man nachträglich Software installieren kann. Auch für Cygwin gibt es ein derartiges Tool - cyg-apt. Ich kann nur empfehlen, dieses Tool einzusetzen, erleichtert es doch die nachträgliche Installation von z.b. von PHP benötigten Libraries erheblich. cyg-apt ist in Python geschrieben, weshalb bei der Installation von Cygwin auch die Installation von Python berücksichtigt werden sollte.

Als nächstes habe ich mir die Quellen des aktuellen PHP (5.2) besorgt. Wenn man MySQL Support wünscht, wird ausserdem noch der Quellcode von MySQL benötigt.

Zunächst muss man also MySQL kompilieren - da wir unter Cygwin nur die Client Bibliotheken benötigen, werden auch nur diese compiliert:


./configure --prefix=/usr --without-server
make
make install

Als nächstes kann man dann PHP mit fastCGI Unterstützung compilieren. Man beachte hierbei, dass ‘fastCGI’ unter Windows zu Problemen führen kann. Falls es später tatsächlich zu Problemen kommt, kann man dann aber PHP immernoch als CGI Anwendung unter LightTPD verwenden. Eine PHP Configuration könnte z.b. folgendermassen aussehen:


'./configure' '--prefix=/usr' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--with-pear=/opt/pear' '--with-mysql' '--with-mysqli=/usr/bin/mysql_config' '--enable-memory-limit' '--enable-bcmath' '--enable-calendar' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-dbx' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-fastcgi' '--enable-force-cgi-redirect'

Alle Bibliotheken, die PHP zusätzlich noch benötigt, kann man i.d.R. per ‘cyg-apt’ nachinstallieren.

Nachdem auch PHP compiliert und installiert wurde kann man sich nun die Quellen von LightTPD besorgen. Ein einfaches ‘./configure –prefix=/usr’ und ‘make; make install’ reicht hier in der Regel aus, um LightTPD mit den wichtigsten Modulen zu Compilieren und zu Installieren. Die Konfiguration für LightTPD findet man anschliessend unter ‘/etc/lighttpd/lighttpd.conf’ und könnte wie folgt aussehen:


# default document-root
server.document-root = “/data/www/htdocs”

accesslog.filename = “/var/log/lighttpd/access.www.log”

server.port = 81

$SERVER[”socket”] == “127.0.0.1:80″ {
server.username = “nobody”
server.groupname = “nogroup”
server.errorlog = “/var/log/lighttpd/error.www.log”

fastcgi.server = ( “.php” =>
(( “host” => “127.0.0.1″,
“port” => 1026,
#”socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/bin/php”,
“bin-environment” => (
“PHP_FCGI_CHILDREN” => “4″,
“PHP_FCGI_MAX_REQUESTS” => “100″
),
“bin-copy-environment” => (
“PATH”, “SHELL”, “USER”
),
“broken-scriptfilename” => “enable”
))
)

# configure server
$HTTP[”host”] == “localhost” {
simple-vhost.server-root = “/data/www/”
simple-vhost.default-host = “localhost”
simple-vhost.document-root = “/htdocs/host/”
}

server.document-root = “/data/www/htdocs/host/”
}

# index filenames
index-file.names = ( “index.php”, “index.html”, “index.htm”, “default.htm” )

# selecting modules
server.modules = ( “mod_rewrite”, “mod_auth”, “mod_access”, “mod_accesslog”, “mod_fastcgi”, “mod_redirect”, “mod_simple_vhost” )

# disable directory listings
server.dir-listing = “disable”

# mime types
mimetype.assign = (
“.pdf” => “application/cation/pdf”,
“.ps” => “application/postscript”,
“.gz” => “application/x-gzip”,
“.pac” => “application/x-ns-proxy-autoconfig”,
“.swf” => “application/x-shockwave-flash”,
“.tar.gz” => “application/x-tgz”,
“.tgz” => “application/x-tgz”,
“.tar” => “application/x-tar”,
“.zip” => “application/zip”,
“.mp3″ => “audio/mpeg”,
“.m3u” => “audio/x-mpegurl”,
“.wma” => “audio/x-ms-wma”,
“.ogg” => “application/ogg”,
“.wav” => “audio/x-wav”,
“.gif” => “image/gif”,
“.jpg” => “image/jpeg”,
“.jpeg” => “image/jpeg”,
“.png” => “image/png”,
“.xbm” => “image/x-xbitmap”,
“.xpm” => “image/x-xpixmap”,
“.xwd” => “image/x-xwindowdump”,
“.css” => “text/css”,
“.html” => “text/html”,
“.htm” => “text/html”,
“.js” => “text/javascript”,
“.dtd” => “text/xml”,
“.xml” => “text/xml”,
“.mpeg” => “video/mpeg”,
“.mpg” => “video/mpeg”,
“.mov” => “video/quicktime”,
“.qt” => “video/quicktime”,
“.avi” => “video/x-msvideo”,
“.asf” => “video/x-ms-asf”,
“.asx” => “video/x-ms-asf”,
“.bz2″ => “application/x-bzip”,
“.tbz” => “application/x-bzip-compressed-tar”,
“.tar.bz2″ => “application/x-bzip-compressed-tar”
)

Da unter Windows fastCGI nicht über Sockets funktioniert, muss es über TCP durch Angabe der Parameter Host und Port konfiguriert werden. Testweise kann man nun LightTPD folgendermassen starten:


/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

Abschliessend soll man LightTPD noch als Windows NT Service installieren können. Hierfür benötigt man das Dienstprogramm ‘cygrunsrv’, das man ggf. per ‘cyg-apt’ nachinstallieren muss. Der Befehl zum einrichten von LightTPD als Service sollte nach meinen Recherchen dann wie folgt aussehen:


cygrunsrv --install lighty --path /usr/sbin/lighttpd --args "-D -f /etc/lighttpd/lighttpd.conf" --disp "cygwin - lightTPD"

Leider hat die Installation als Service bei mir noch nicht geklappt.

Nachdem nun also PHP und LightTPD installiert sind, fehlt nur noch die Datenbank - MySQL. Da für PHP schon mit den Client Bibliotheken compiliert wurde, reicht es aus, wenn über die MySQL Web Seite der MySQL Installer für Windows heruntergeladen wird. Darüber kann man dann MySQL komfortabel über den Setup Wizard installieren und mit dem Testen und Entwickeln loslegen.

Das hier vorgestellte Setup funktioniert übrigens nicht nur wunderbar für PHP, sondern z.b. auch für Ruby (on Rails), Python oder Perl.

Avoiding the 5 Most Common SEO Mistakes

Wednesday, November 22nd, 2006

Are your SEO efforts hampered by any of the 5 most common SEO mistakes? They’re not difficult to rectify … once you know what they are! Johnathon explains them clearly, and shows you how to correct them, in this hands-on tutorial.

PhpEd vs Zend Studio

Wednesday, November 15th, 2006

Many years ago I bought version 3 of Nusphere’s PhpEd. To cut a long whine short, I was sorely disappointed with it. It was full of bugs and couldn’t do some of the most basic tasks. I complained, didn’t get very far, and dropped it and some months later moved onto the Zend IDE instead. I used this for years, and while it had flaws, it also had just about the right level of features for me.

A few months back Nusphere emailed me to say that version 4.6 of PhpEd was out, and did I want to trial it. I figured what the heck, and here is what I found out when you compare the two …
Continue reading “PhpEd vs Zend Studio”

ASP.NET 2.0: A Getting Started Guide

Wednesday, November 8th, 2006

Are you ready to take off into the wide blue yonder of ASP.NET 2.0? Join Cristian and Zak on this eventful ride: you’ll tame the installation process, sink your teeth into two ASP.NET languages, and conquer .NET programming basics with your bare hands. Finally, you’ll pull server controls, user controls, master pages, and CSS into the beginnings of an application that will see you land safely - and without casualties - at the start of a brilliant career in ASP.NET programming.

PHP Conference Brasil 2007

Wednesday, November 1st, 2006

November 30th - December 1st, Join us at the 2nd Annual PHP Conference Brasil. The event will take place at UNIFIEO in Osasco, São Paulo. This year’s conference will have room for 1000 people. Its scheduled for tutorials of 3 hours, aside of speeches, cases, stands and a great catch up time for newbies and veterans. Visit the website for more details. Early registration with discounted price is available until November 9th.