Category: PHP

  • Getting the current interpreter in PHP

    Recently a friend of mine asked if there is a way to dynamically find out the path of the PHP executable. The working scenario was: running some scripts (from the command line) which would spawn other scripts and rather than hardcoding the path to the PHP interpreter he wanted to use the same interpreter when…

  • An argument (against) PHP

    Via Perlbuzz I landed at the blog posting An Argument for PHP, which I disagree with. First a little about my background: I’ve been programming in PHP almost twice as long (6+ years) as in Perl, so (hopefully) it isn’t the case that I don’t know what I’m talking about. PHP seemed nice and shiny…

  • HTTP Redirection with PHP – a complete solution

    The problem: you need a generic code which redirects to the current URL or some URL relative to the current one. One of the reasons you might want to do that is to avoid the possibility of users submitting a POST form multiple times (even though both IE and FF – and I suppose also…

  • Reading the fineprint in the documentation

    Following the DokuWiki development mailing list, I saw the following changelog: Sun Apr 6 19:47:18 CEST 2008 Andreas Gohr * work around strftime character limit on parsing namespace templates FS#1366 I checked on the PHP documentation page (by the way, a quick tip: you can access the documentation for a given PHP function by appending…

  • Updating PHP in XAMPP for Windows

    Inspired by the YAIG blog, here is my how to do it post: XAMPP is a great suite to quickly get up and running with Apache, PHP, Perl and MySQL. Warning! It is not aimed to be used in a production environment! Its settings are geared towards ease of use rather then security! However I…

  • Serving up authenticated static files

    Two components which are usually found in web applications are authentication and static files. In this post I will try to show how these two interact. The post will refer to PHP and Apache specifically, since these are the platforms I’m familiar with, however the ideas are generally applicable. The advantages of static files are:…

  • Compressed HTTP

    The HTTP standard allows for the delivered content to be compressed (to be more precise it allows for it to be encoded in different ways, one of the encoding being compression). Under Apache there are two simple ways to do this: Using the mod_deflate Apache module If you have mod_php activated, setting the zlib.output_compression variable…

  • Input validation

    The month of PHP bugs is over, but you should still watch the PHP-Security blog, since there are good things coming from there, like this article: Holes in most preg_match() filters. Go read it if you are using regular expressions for input validation. Two tips to avoid these pitfalls: Cast your input to the datatype…

  • Month of PHP bugs roundup

    The month of PHP bugs is over and I thought that I make a little list with things you can do to mitigate the bugs where possible: Update to PHP 5.2.1 and watch out for the next version and update to it as soon as it comes out. Do not PHP4, because there is a…

  • Update on the Month of PHP Bugs

    The month is nearing to an end (but fear not, next month we will have a month of MySpace bugs it seems), and here are the latest developments: Two bugs using which you can bypass the open_basedir restriction. They are in the user-contributed PECL modules, so there is a chance that they will be fixed…