HTML5 + Quake2 = AWESOME!

HTML5 is still a work in progress and some browsers can’t do what others can at the moment.  List for geeks:  Comparison_of_layout_engines:  HTML5.  An example for the not so geeky:  Chrome and Safari allows HTML5 video streaming on Youtube while Firefox does not.  While this will all change in good time, a great show of HTML5′s potential has been shown.  A port of a classic game, Quake II, has been made available to play via your web browser!  Freaking awesome!!

It’s all still very beta. Depending on which browser you try(ATM only Chrome and Safari) and it’s version you may experience slow FPS, no sound and screen flickering.

To help minimize fail, before you start to follow the instructions on installing quake2-gwt-port make sure you have the following installed before hand.

  • vorbis-tools
  • lame
  • jdk

Installing JKD before trying to run “./build-dedicated-server” is important.  I thought I had it still installed on my system, and when that failed to build I went, “DUH” and installed it.  However, it still would work.  I had to killed the cloned source directory and start over.  After that I was able to get a bit further but also ran into an issue with it looking for tools.jar in “/usr/lib64/java/../lib/tools.jar”.  As you can see it’s telling it to leave the java directory which is WRONG!  So a quick fix was to symlink the “/usr/lib64/java/lib” directory in my “/usr/lib64″ directory.

ln -s /usr/lib64/java/lib /usr/lib64/lib

After that it built fine and I was able to run the server.  YEY!!

The things I’ve noticed that didn’t work or were buggy:

  • Changes settings in the default.cfg located in “quake2-gwt-port/war/baseq2″ does not appear to change anything.  Adding a autoexec.cfg also did nothing
  • Gamma was too low to play
  • Sound was a bit off and most of the time the effect happening would have no sound or a delayed sound.  I was receiving a lot of errors from chrome about it unable to set the hw params.  Here is what they looked like for me:
  • Errors in the console saying that it couldn’t load a file.  It would reference a number like:  “#144″ 4 or 5 times but the number wasn’t always the same.  I noticed it changed if i closed chrome and reopened to restart the game.
  • Graphic glitches would show the green/black polygon shapes only for a moment before fully loading


Create a file, IE:  Cut and paste the following into that file and make it executable

xgamma -gamma 1.8
/opt/google/chrome/chrome --enable-webgl --no-sandbox
xgamma -gamma 1

Thats it!  Please note that this only works if no other chrome sessions exist.  If the gamma is too high, lower it to 1.6 or 1.4 until it’s good enough for you.

If you find out any way to solve the sound issues in chrome, let me know or be sure to mention it on the project page!

Happy Quaking!

Reblog this post [with Zemanta]

Apache+suEXEC+FastCGI+PHP-FPM+APC - Part 2

Click here: PART 1, if you’ve came to this directly from a Google search or you need to compile the FastASS-CGI combo.

Alright, you should have a working FastASS-CGI Configuration!  Yes, I’ve dubbed it FastASS-CGI (Fast, Apache, suexec, suhosin, Fastcgi+PHP-FPM and APC)  Those last three all go to gether which is why I just dubbed it CGI at the end.  If you have a problem with it, well… fsck you.  :P  Hahahaha, joking aside lets get into the deep and dirty portion of this configuration.

This whole part looks relatively easy but took me the longest of all to figure out.  I plan on explaining how exactly everything works in detail, so for those that already know or those just looking for the answer, sorry you’re going to have to push through this and deal with it.

Lets recap and make sure we didn’t miss anything:

  • Recompiled apache for suexec
  • Recompiled PHP and patched it for suhosin and php-fpm
  • Compiled FastCGI
  • Compiled APC
  • Made slight conf changes where needed to include all those items
  • Started Apache and PHP-FPM daemon
  • Checked logs for errors

Alright, so you probably tried to start the PHP-FPM daemon, and it threw out an error about needing some user/group information.  Since we’re using suexec, we want the owner and group option to be whatever user/group is utilizing this.  So for example you’ve created a user and group the same name as your website IE: learnix, that’s what those values would contain.  Here’s a portion of my configuration:

<value name="listen_options">
 Set listen(2) backlog
 <value name="backlog">-1</value>
 Set permissions for unix socket, if one used.
 In Linux read/write permissions must be set in order to allow connections from web server.
 Many BSD-derrived systems allow connections regardless of permissions.
 <value name="owner">learnix</value>
 <value name="group">learnix</value>
 <value name="mode">0666</value>

And then just below that, you would do the same:

Unix user of processes
 <value name="user">learnix</value>
 Unix group of processes
 <value name="group">learnix</value>

So the first bit is setting the permisions if a socket is used.  In my example, I don’t use one so they are not nessessary.  However, I do recommend setting them in any case because it doesn’t hurt anything to plan for the future if you choose to use a socket over an ip connection.  The second part sets the user for who will be running the php-cgi process, which is very important.  This should be your user and not apache, www-data, nobody etc. etc.(all depending on your distro) if you are using userdir mode.

Configuring your virtual host is easy, but was a bit complicated for me to figure out.  After I had figured it out, I went back to the fastcgi documentation and re-read it.  I was misunderstanding it the whole time and I hope to provide a better explanation here.
What we only want our php scripts/files to be handled by the php-cgi process.  Everything else needs to be handled by apache.  So we must first make a new directory at the same level that our root directory, public_html, lives.  In this example i created virtual_html.  Inside of that directory we want to symlink our root, public_html, so that’s basically like our webroot with a symlink.

mkdir -p ~/virtual_html
cd ~/virtual_html
ln -s ~/public_html

From here, we just need to modify our virtual host configuration to use everything we’ve done.  In my example below you will see some commented sections for a fastcgi wrapper script.  I left those there in case anyone needed examples of those as well.  Plus I always find it handy to be able to reference something I once did in case I need to use it in the future.

DocumentRoot /home/learnix/public_html
SuexecUserGroup learnix learnix
DirectoryIndex index.html index.htm index.php index.php4 index.php5
Options +ExecCGI +FollowSymLInks +SymLinksIfOwnerMatch
# This is the wrapper script section.
#ScriptAlias /fcgi-bin "/home/learnix/public_html/cgi-bin/php-fastcgi.fcgi"
#AddHandler php-fastcgi .php
#Action php-fastcgi /fcgi-bin
# This is to forward all PHP to php-fpm.  Only this or script alias should be active
# at any time, not both
FastCgiExternalServer /home/learnix/virtual_html/public_html -host -user learnix -group learnix
AddHandler php-fastcgi .php
Action php-fastcgi /virtualhtml
Alias /virtualhtml /home/learnix/virtual_html/public_html/
# You must make a virtual directory so that you don't send everything web
# related to php-cgi.  This is only if you are using FastCgiExternalServer
Options +ExecCGI +FollowSymLInks +SymLinksIfOwnerMatch
AllowOverride all
Order allow,deny
Allow from all
Options +ExecCGI +FollowSymLInks +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AllowOverride all


First is the path of our “virtual” web root.   We want this to be the full path.  I am using the ipaddress/port scheme.  You can also use the socket method which is supposed to be faster but I’m not covering that in this how to.  You will need to change the user and group to whatever you andered in your php-fpm.conf.


First part of this can be anything you want as far as i know and understand.  Naming it something that has some meaning to what you are doing and how you are going to use that handle makes the post sense.  Next is the extension of files that this handler will take responsibility for.


This is where we define how the handler will be treated.  In this case we are saying that all .php files are only going to come from /virtualhtml which is an alias to our “virtual_html” directory.

Now you have to treat that directory like you would your public_html directory.  So we create a directive for it an specify our options.  The most important part is the Symlink options.  Without them, this whole thing wont work.

Okay, this should be it.  Restart php-fpm and apache.  Check your logs and try and view you website.  Hopefully all went well and not only is your website viewable, it’s much faster at loading.  Lets rerun that apache benchmark we did in Part 1 and compare the difference.  Change “” to your websites domain name.

ab -n 50 -c 3 -k

Hopefully there is a difference. There was for me.

This concludes the two part FastASS-CGI How-To.

Reblog this post [with Zemanta]

Apache+suEXEC+FastCGI+PHP-FPM+APC - Part 1

This part 1 is going to focus on the Slackware side of things in order to prep your server to use all of the above.  If you are not running Slackware, don’t nessessarily skip this section, as the configure options for compiling everything are still very important and apply to any distro.  If you already have everything recompiled, installed, etc. I would skim this to make sure (if you were recompiled before seeing this) that you used the options I did or at least are familiar with them so that when I reference them later you can apply them to your setup if you choose different options at compile time.  (Wow, that was a mouth full..(that’s what she said..))  Ha ha ha.

Before we start, lets do a benchmark of our current configuration of apache with php.  Be sure to save the output to comepare it with the end results at the end of Part 2.

ab -n 50 -c 3 -k

I am using a fully up to date Slackware 13.0 installation at the time of this writing.  I choose not to install the following “disk sets”, E, KDE, KDEI, X, XAP, Y when upgrading my Linode 360 from 12.2 to 13.0.  I keep a local copy of the source on my Linode just in case.  You will need the source from the Slackware 13.0 repo for the following programs:

  • httpd
  • php

As of this writing,  both are under the patches directory.  You can do the following to download the source:

lftp -c "open; mirror httpd; mirror php"

Next we will just need to modify a few things in both slackbuilds.  Besure to increase the $BUILD  by +1 in both slackbuilds.

HTTPD SlackBuild

First start with httpd.  Open the httpd.SlackBuild in whatever your editor of choice is.  Add the following lines just above “–build=$ARCH-slackware-linux || exit 1″

--enable-suexec \
--with-suexec-bin=/usr/sbin/suexec \
--with-suexec-caller=apache \
--with-suexec-userdir=public_html \
--with-suexec-docroot=/home \
Now the last two options may be optional for you.  If you aren’t using apache in userdir mode, you should be able to just remove them entirely.  I didn’t test that though, YMMV.  Please leave a comment down below if you tested it without userdir and if it worked, options you had to change etc. etc.

Now run the SlackBuild and upgrade the package.  To check and make sure that it build properly:

suexec -V

This will output something along the lines of:

 -D AP_DOC_ROOT="/home"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/var/log/httpd/suexec_log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=100
 -D AP_USERDIR_SUFFIX="public_html"
Alright, looks good.  If you are a slackware user, you will need to add this to your httpd.conf above your “vhost” line, like so:
# Uncomment the following line to enable <a class="zem_slink" title="PHP" rel="homepage" href="">PHP</a>:
#Include /etc/httpd/mod_php.conf
# FastCgi Config
# **Must go before your virtual hosts**
Include /etc/httpd/mod_fastcgi.conf
# Virtual hosts
Include /etc/httpd/extra/httpd-vhosts.conf

Please note that mod_php.conf is commented out, this must be done.  The fastcgi.conf will be added in a little bit as well.  Okay, everything looks good so lets move on.

PHP SlackBuild

Same thing here, open the php.SlackBuild up. This one requires a few more tweaks.

Completely remove the IMAP section, unless you need it.

# we need to compile alpine to get c-client.a for IMAP support:
if [ -r $IMAPLIBDIR/lib${LIBDIRSUFFIX}/c-client.a ]; then
echo "Using IMAP library:"
ls -l $IMAPLIBDIR/lib${LIBDIRSUFFIX}/c-client.a
sleep 5
( cd $CWD/../alpine ; ./alpine.SlackBuild || exit 1 ) || exit 1
( cd $TMP/alpine-${ALPINE}/imap/c-client
strip -g c-client.a
cp c-client.a $IMAPLIBDIR/lib${LIBDIRSUFFIX}
mkdir -p $IMAPLIBDIR/include
cp *.h $IMAPLIBDIR/include


--with-imap-ssl=/usr \
--with-imap=$IMAPLIBDIR \

Just above the php_configure() function add:

wget || exit 1
gunzip php-5.2.12-fpm-0.5.13.diff.gz || exit 1
patch -f -p1 < php-5.2.12-fpm-0.5.13.diff
wget || exit 1
gunzip suhosin-patch-5.2.12-0.9.7.patch.gz || exit 1
patch -f -p1 < suhosin-patch-5.2.12-0.9.7.patch
./buildconf --force

Okay, now we need to replace this:

# Make the <a class="zem_slink" title="FastCGI" rel="wikipedia" href="">FastCGI</a> interpreter:
make distclean
php_configure \
--enable-fastcgi \
--enable-pcntl \
make $NUMJOBS || make || exit 1
mkdir -p $PKG/usr/bin
cat sapi/cgi/php-cgi > $PKG/usr/bin/php-cgi
chmod 755 $PKG/usr/bin/php-cgi

With this:

## Make the FastCGI interpreter:
make distclean
php_configure \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-fpm \
--with-fpm-pid=/var/run/ \
--with-fpm-log=/var/log/php-fpm.log \
--with-fpm-conf=/etc/httpd/php-fpm.conf \
--with-fpm-init=/etc/rc.d/rc.php-fpm \
--enable-pcntl \
make $NUMJOBS || make || exit 1
mkdir -p $PKG/usr/bin $PKG/etc/{httpd,rc.d}
cat sapi/cgi/php-cgi > $PKG/usr/bin/php-cgi
cat sapi/cgi/fpm/php-fpm.conf > $PKG/etc/httpd/php-fpm.conf
cat sapi/cgi/fpm/php-fpm > $PKG/etc/rc.d/rc.php-fpm
chmod 755 $PKG/usr/bin/php-cgi $PKG/etc/rc.d/rc.php-fpm
chmod 644 $PKG/etc/httpd/php-fpm.conf

** Optional **
I added mcrypt support in for phpmyadmin.  First, install mcrypt with sbopkg.  Next you need to add “–with-mcrypt” in the php_configure() function, aka the “kitchen sink”.

Last think you might want to look at is the $NUMJOBS and change it from -j7 to whatever fits your current host.  Execute the slackbuild and upgrade the package.


I’ve made a SlackBuild for this.  I haven’t submitted it to as of yet(at the time of writing this) but I will afterwards.  Here is the link,  The fcgi.tar.gz contains everything in that directory.  I’m working on the index script that will just hide that file but offer the download link below the source link.


I’m in the process of making the slackbuild for APC.  You can try to install it via:

pecl install apc

But, at least for me, it didn’t work.  I got a phpize error and I didn’t feel like spending a bunch of time trying to figure out why.  So I just did this:

cd /tmp/pear/download/APC-3.0.19
./configure --enable-apc-mmap --with-apxs --with-php-config=/usr/local/php/bin/php-config
make && make install

This will install the php extension only.  Copy the “apc.php“, found in the apc source root,  to your web root.  This is used to view the stats of APC, clear the cache, etc.  You will also want a apc.ini in your /etc/php directory.  Here is my, which mostly what is suggested withing the INSTALL file located in the source.

cat /etc/php/apc.ini
; /etc/php.d/apc.ini
extension =
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 90
apc.optimization = 0
apc.num_files_hint = 4096
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 0
apc.cache_by_default = 1
apc.filters = ""
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 5M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
;apc.rfc1867	= 0
;apc.rfc1867_prefix = "upload_"
;apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
;apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0

You may or may not need to adjust this to your settings.  YMMV with this, but at least it’s a good starting point to be able to continue on with the rest of the configuration.


There are two parts to suhosin.  We applied the suhosin patch to the php source which protects from format string vulnerabilities but the extension is where all the money’s at.  This was on of the easier ones to install as there is a SlackBuild for it.  You can get it HERE or use sbopkg to install it.

To make sure things are working, restart apache and start php-fpm.

/etc/rc.d/rc.httpd restart
/etc/rc.d/rc.php-fpm start

Check your logs.  Make sure everything started up correctly.  View your website, make sure it displays correctly.  Check your php config.  There’s a couple ways of doing this.  In your web root, create a file called:  phpinfo.php and put this inside:


From your web browser you would view it by going to  You can search for fastcgi, php-fpm and apc.ini.  It will tell you that those options were compiled in and/or in use.  You should also check out, , to check that apc is working.

This concludes Part 1 of this guide.  Next we will go over all the configuration options to put all of this together.

Part 2

PS: I make mistakes.  This is a long guide.  If you see one, please let me know.  Thanks!
Thanks for pointing those out Seth!

Reblog this post [with Zemanta]
# FastCgi Configuration
LoadModule fastcgi_module /usr/lib/httpd/modules/
AddHandler fastcgi-script .fcgi .fcg .fpl
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
#FastCgiConfig -singleThreshold 100 -killInterval 300 -autoUpdate -idle-timeout 20 -pass-header HTTP_AUTHORIZATION
FastCgiWrapper /usr/sbin/suexec
<Location “/fcgi-bin/php-fastcgi.fcgi”>
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
Options +ExecCGI +FollowSymLInks +SymLinksIfOwnerMatch
SetHandler fastcgi-script
#DirectoryIndex index.html index.shtml index.cgi index.php
#AddType application/x-httpd-php .php
#AddType application/x-httpd-fastphp .php
#Action application/x-httpd-fastphp /fcgi-bin/php-fastcgi

Huge update for a lot of my SlackBuilds

I’ve been running -current ever since the huge list of updates hit the changelog.  With bash 4 out of extra, it’s only a matter of time before -current hit’s stable and everyone is on it.  Because of this, it requires many of us who build sloppy SlackBuilds and/or missed things (I’m guilty of this), to go back and fix them because bash 4 says, “FFFFFFFFFFFFFFFUUUUUUUUUUUUU”!!!!!

The two major things I’ve ran into with my builds and other builds are:

  • Man pages.  There were no man pages to copy but the line to do so was there.
  • The “strip” lines not having “|| true” at the end.  Read more here, @ #19.

I have fixed, updated and tested the following packages all on Slackware13, Slackware64-13 and Slackware-current:

frei0r, goocanvas and pygoocanvas

These packages only needed the two above fixes.  frei0r will probably not receive a version change unless a huge bug is found or something stops working etc. etc.


The MLT Framework got an update to 0.5.2 besides the above fixes.  There have also been a few issues reported via email to be about the current SlackBuild on the website that have been address and are fixed.  Until they are updated on that website you can get them from mine.


Openshot has been updated to version 1.1.1.  There was also a missing dep, pyxdg, in the README which has been added.  Same as mlt, get them from my site until is update with what I offer.


Version update to 4.3.6.

As for my other SlackBuilds, ahhh…. I’ll get to them later.  I promise.  ESP. the bacula one… good god.  Been putting that off for a while.

mlt and openshot slackbuild updates

Thanks to Dominic for emailing me about the mlt and openshot build issues.  I’ve corrected the problems and submitted the updates to

In the mean time you can grab the builds from my site.  I’ve also added two sbopkg queue files that you can download to make the whole process easier.  I suggest checking out, and (hint, ffmpeg queue lives there).

Slackbuilds section up and running

Well big thanks to Dive for giving me his layout for his Slackbuilds directory index listings.  I thought that it was very smooth and clean looking, makes fancy indexing look like ass.  So thanks Dive, it’s much appreciated.

Slackbuilds link is under the Slackware menu.  Or on the side panel.  Some of these may wind up on, some may not.  If they don’t it’s more than likely because I chose not to submit it.  Or in the case of my bacula script because it needs to be broken up into two scripts to do clients and servers.  Figured I’d leave it to do both in case anyone or myself would want to use that in the future.

If I update a buildscript I will make a post about it so that it’s easily known.  If you’d like me to update one of my scripts, shoot me an email.  Same with if you are having any problems building said package.

Extra dep’s to go along with Farsight2

***UPDATE*** 1/15/2010
It’s been a while since I’ve tested the whole V&V with pidgin but I remember that installing these packages did not fix my problem.  Still had issues with V&V working on one end and not the other, the suddenly stopping.  It has a was to go.  Maybe these have become more part of farsight2 now though who knows.

A few of us in the ##slackware channel have been working on getting voice and video to work with the latest pidgin release.  However, so far most of our efforts have been in vain.  Sometimes it works, sometimes it doesn’t.  I can never send the request and get it to work however others can send to me just fine.  I’ve tried all sorts of things on my end, including opening up the whole “world” to the inside of my network… Still nada.

Saw that farsight2 required gupnp-igd.  Here are all the packages I’ve build to SBo standards.
They must be built in this order.

From SBo
*libsoup  (from SBo)

From my Slackbuilds

Then finish by rebuilding
*pidgin(i did it to be on the safe side but i don’t think it might be necessary)