PHP and sessions: Very simple to use, but not as simple to understand as we might want to think.session.gc_maxlifetimeThis value (default 1440 seconds) defines...
PHP and sessions: Very simple to use, but not as simple to understand as we might want to think.session.gc_maxlifetimeThis value (default 1440 seconds) defines how long an unused PHP session will be kept alive. For example: A user logs in, browses through your application or web site, for hours, for days. No problem. As long as the time between his clicks never exceed 1440 seconds. It's a timeout value.PHP's session garbage collector runs with a probability defined by...
PHP and sessions: Very simple to use, but not as simple to understand as we might want to think.session.gc_maxlifetimeThis value (default 1440 seconds) defines how long an unused PHP session will be...
Always messed around with a combo of opendir(), readdir(), and closedir() if you wanted to read the contents of a directory? Since PHP 5 there is a new sheriff...
Always messed around with a combo of opendir(), readdir(), and closedir() if you wanted to read the contents of a directory? Since PHP 5 there is a new sheriff in town: scandir():<?php $files=scandir("/etc/php5");print_r($files);?>Outputs:Array( [0] => . [1] => .. [2] => apache2 [3] => conf.d)Okay, you still need to traverse an array, but it's much easier to use than the traditional way.
Always messed around with a combo of opendir(), readdir(), and closedir() if you wanted to read the contents of a directory? Since PHP 5 there is a new sheriff in town:...
My last week blog topic was very much marked by Apache load balancing. Well, I promised to leave this topic alone for a while, but there is one related topic...
My last week blog topic was very much marked by Apache load balancing. Well, I promised to leave this topic alone for a while, but there is one related topic that is worth spending a minute on.The TheoryIf your web application is distributed across multiple servers you'll quickly run in sessions problems because each backend server (aka worker) usually stores its session informations locally.Now, if subsequent HTTP requests are handled by different workers, every time a new...
My last week blog topic was very much marked by Apache load balancing. Well, I promised to leave this topic alone for a while, but there is one related topic that is worth spending a minute on.The...
Yesterday, I started a small tutorial on how to implement typographic headlines with PHP. There were some aspects to be aware of, but in general it was an easy...
Yesterday, I started a small tutorial on how to implement typographic headlines with PHP. There were some aspects to be aware of, but in general it was an easy and straight forward process. The final result looked like this:But there was one big issue I had with my script: It was far to slow (33 requests per second) for use in a production environment. But today, I'll extend my previous script with a simple caching mechanism to make it ready for the real world.Welcome to the...
Yesterday, I started a small tutorial on how to implement typographic headlines with PHP. There were some aspects to be aware of, but in general it was an easy and straight forward process. The final...
My recent blog post about scaling images with PHP gave me the idea to write something about creating typographic headlines with PHP. At Apache Friends we're...
My recent blog post about scaling images with PHP gave me the idea to write something about creating typographic headlines with PHP. At Apache Friends we're using this technique since many years to get rid of the usual boring and everywhere available "web fonts" like Helvetica, Times and Verdana.For this example I chose the font Tusj by Norwegian graphic designer Magnus Cederholm. Okay, this font will only work for very large headlines, but it's looks cool and it's perfect...
My recent blog post about scaling images with PHP gave me the idea to write something about creating typographic headlines with PHP. At Apache Friends we're using this technique since many years...
Scaling images in PHP is quite easy, but there are some things to consider. (If you're short of time, right at the end you'll find the final script.)Read the...
Scaling images in PHP is quite easy, but there are some things to consider. (If you're short of time, right at the end you'll find the final script.)Read the original image with imagecreatefromjpeg()First of all you'll need to read the original image. If it's a JPEG file the imagecreatefromjpeg() function is the right choice:$source_image = imagecreatefromjpeg("osaka.jpg");If it's a GIF file you'll take imagecreatefromgif(), and if it's a PNG you will...
Scaling images in PHP is quite easy, but there are some things to consider. (If you're short of time, right at the end you'll find the final script.)Read the original image...
If you're using PHP you're usually don't care how PHP stores variables internally. But if you start working with references you probably better know what's...
If you're using PHP you're usually don't care how PHP stores variables internally. But if you start working with references you probably better know what's going on behind the scenes.(Without) ReferencesLet's assume the following code:$a="Zaphod";$b=$a;$c=$a;You probably would assume that PHP now keeps the string Zaphod three times in memory. Actually all $a, $b and $c internally(!) reference to the same string Zaphod in memory. See diagram #1.You, the user, will never know...
If you're using PHP you're usually don't care how PHP stores variables internally. But if you start working with references you probably better know what's going on behind the...
I love AWK. It is a wonderful tool for data processing on Unix systems. I truly love it. There is certainly no better tool to process and aggregate log files. I...
I love AWK. It is a wonderful tool for data processing on Unix systems. I truly love it. There is certainly no better tool to process and aggregate log files. I remember back when I introduced AWK to my students, there was always an immediately appreciative murmur in the round when the first AWK scripts showed their power.And it's so stable. Perhaps even more stable than all the new-fashioned stuff nowadays. I have one AWK monster script running since 1992 unchanged in a...
I love AWK. It is a wonderful tool for data processing on Unix systems. I truly love it. There is certainly no better tool to process and aggregate log files. I remember back when I introduced AWK to...
Last weekend Germany's most intellectual elite of PHP ubergeeks came together for two days full of interesting and surprisingly entertaining sessions and...
Last weekend Germany's most intellectual elite of PHP ubergeeks came together for two days full of interesting and surprisingly entertaining sessions and discussions. Although it was a very informal and student-friendly event (just drop an eye on the picture above), I was pleasantly surprised by the high level and quality of this event. Yes, events like unconferences, barcamps or BoFs become serious competitors for all so-called professional conferences.I was also very...
Last weekend Germany's most intellectual elite of PHP ubergeeks came together for two days full of interesting and surprisingly entertaining sessions and discussions. Although it was a very informal...