Tag Archives: PHP

Taking HHVM 3.0.0 for a spin

Not even a day has passed since Facebook released a new version of their PHP virtual machine called HHVM. If you don’t know HHVM and you’re coding PHP, you’ve probably been living under a rock for the last few years, but the point is, it’s blazing fast. As a matter of fact it’s so fast that at the moment the network latency on my blog is more of an issue than page rendering speed, and I haven’t even started to do any optimization.

What’s also cool about version 3.0.0 is the fact that the old HTTP engine is gone, instead HHVM is now reachable via FastCGI, which makes it an (almost) drop-in replacement for PHP-FPM. It also supports Hack Lang, which is a strongly typed variation of PHP. It should be noted, however, that it’s not 100% PHP compatible, so you might run into some compatibility issues. So, that being said, why don’t we take it for a spin?
Continue reading

Don’t make me think! on PHP code

If you’ve ever done any UI work, you almost surely encountered the book Don’t make me think by Steve Krug. The sole job of usability is to ensure a flow feeling for the customer. Anything that breaks that flow, makes the customer stop and think, is bad for conversion towards your target page.

When coding, you can have a similar flow feeling. You get into your zone, start coding and you just write the code that does exactly what you want – unless something interrupts you. The most common reason for this interruption in my experience is bad code. Code that you don’t know, code that’s not logical to use, code that contains bugs. If you’ve ever worked on larger systems, you know the annoyance of working with bad code. So the logical question is, how do you write slightly less crappy code?

Continue reading

LAMPSecurityToolkit v2.0 is in the making, get your feature requests in now!

If you’ve been following my online activity for some time, you might remember a quick and dirty project some 3 years ago: LAMPSecurityToolkit. My aim was to create a PHP-based interface to do a quick check on the most basic PHP security settings to help emerging system administrators to keep their servers secure. Although the feature set has been limited and the interface was rather crude, the tool was useful. Now it is time to create version 2.0.

LAMPSecurityToolkit v2.0

So get your feature requests in by the end of March and they might just make it into version 2.0.

Enhance your PHP-fu with code quality tools

Writing good code is an art. There is no magic bullet solution that will make you write good code over night. However, there are a few tools that you can use to remind you of the bad habits you may be doing.

If you are working in a team these tools can be the regulators that help you keep some sort of order in the massive amounts of code you’ll be writing.

Continue reading

Proper time handling with PHP and MySQL

Few developers actually know that not only character encodings but also time handling can cause you headaches when it comes to PHP and MySQL. Contrary to popular belief, PHP’s time handling actually works quite reasonably if you know how time actually works. If you don’t, you may be in for a big surprise when you add 3 days to a date and end up with a date 4 days from now. The answer lies within the *NIX time handling.

Continue reading

I find your lack of faith disturbing

Fixing the Dependency Injection Container in PHP

I’ve been developing PHP well over a decade now and I came to develop a distaste of a phenomenon that has been ravaging the community for quite some time: the lack of code completion. Editors like PHPStorm do an amazing job at discovering variable types, but even they can’t cope with one thing: the Dependency Injection Container.

Framework designers place modularity of their systems above their developer’s convenience, which results in a lot of f-words being thrown while developing. So I went out on a quest to bridge the gap and enable code completion for the Dependency Injection Container.
Continue reading

Setting up Apache with PHP-FPM

Nowadays nginx seems to experience a serious growth in terms of numbers when looking at HTTP server software. Almost all articles regarding PHP-FPM detail the setup with nginx, very few talk about the good old Apache HTTPd. Admittedly, it’s a little harder to set up due to the myriad hacks layered in it’s internal infrastructure. It has one major advantage however: it handles .htaccess files which allows customers to configure their own little corner of the webserver without poking the admin or endangering the server’s stability.
Continue reading