Archive for the ‘PHP’ Category

PHPCompatibility update

Tuesday, October 15th, 2013

Update (Nov 3, 2013) : changed the parameters to reflect the new changes in PHP_CodeSniffer

Just a quick post about the updates made to PHPCompatibility.

I did a talk on PHP 5.4/5.5 at Zendcon, not just about what’s new and why you should upgrade, but also about the way PHPCompatibility can ease the pain. I received very good feedback, as well as very interesting questions. As a result, I added a feature I’ve wanted to add for a long time : the option to specify which PHP version to check for.

Here’s the caveat : it requires a change to PHP_CodeSniffer. I’m hoping that change will be accepted soon. From that point onwards, if you have the latest PHP_CodeSniffer (you might want to get it from Github).

So then you will be able to do :

phpcs --standard= --runtime-set testVersion 5.4 

You can also test for backwards compatibility of your code by specifying versions like 5.2, which causes it to check whether you’re using functions or keywords not known to this older version. Quite nice if you’re coding on PHP 5.5, but your system engineer tells you half way through the project the project will have to be deployed on 5.2.

Important note : if you want to test backwards compatibility, it’s best to run on the latest PHP version available (5.5 right now), for the simple reason that if you have, for example, the keyword ‘yield’ in your code, PHP_CodeSniffer can only recognize it when you’re running PHP 5.5. It can only tell you it’s not available in previous versions if it actually knows what it is.

Expect more compatibility tools soon, as I have some more ideas, such as how to automatically figure out whether and where you’re still relying on register_globals and magic quotes ;-)

flattr this!

Conferences, development, ideas, …

Tuesday, October 2nd, 2012

I just returned from PHPCon Poland, a very nice conference taking place in the middle of beautiful scenery. Although there were only 5 talks in English (3 of which were given by Belgians – Thijs Feryn, Michelangelo Van Dam and myself), the conference was definitely interesting and fun.
I gave a relatively new talk, that I first presented as a 20-min ‘lightning talk’ at ZendCon Uncon 2011. It’s evolved into a 45-min talk (ok, it was only 38-min so I can add some content next time) titled ‘Remove PHP calls and scale your site like crazy’ in which I explain more about the Nginx extension we’re building to improve the performance and scalability of sites with user-specific content. I received some pretty good feedback on Joind.in and lots of people approached me afterwards, wanting to learn even more about it.

I also submitted 6 talks for Confoo, which is supposed to be one of the best web development conferences out there. Not sure if I’ll make it, but if you want to help out, feel free to vote for me. Registration is required to vote, but takes only a minute.

Lots of ideas buzzing in my head, but sadly not enough time to work on them. The Nginx thing is cool, but it’s what I call ‘phase 1′… which means there’s a ‘phase 2′ (in fact, there’s even a ‘phase 3′). But since that requires even more time, it’ll probably be for when phase 1 has been completed.

In the meantime, we’re on the hunt for people looking for a new challenge. If you’re looking to be seriously challenged, check out our jobs page and feel free to tweet/mail/call me ;-)

flattr this!

PHP 5.4 compatibility checks using PHP_CodeSniffer

Sunday, March 4th, 2012

Update (27 Nov) : Support for PHP 5.5alpha is included.

For those of you who are new to this concept, check my blog post from a while ago. It will explain the basic concept of using PHP_CodeSniffer to automate compatibility checks. But don’t use the download links, because they point to the old (PHP 5.3) version !

What’s new ?

Quite a few things have changed in this new release :

  • There’s no version specific release anymore. The previous codesniffer standard was called PHP53Compatibility, but it seemed quite stupid to make a new standard for every PHP version out there, especially since that would keep certain people from upgrading to the latest major PHP version. So the new PHPCompatibility standard works for 5.0 – 5.4
  • But since some people simply can’t upgrade to the latest version, I added version information to all the checks. For example : the deprecated  function checker will now tell you that session_register() is deprecated since PHP 5.3 and removed since PHP 5.4 – if you’re running 5.2 and want to move to 5.3, at least you know right away that you’ll have to fix that problem, because otherwise you can’t ever upgrade to 5.4. This version check is available on deprecated/removed function, deprecated/removed php.ini directives and deprecated/removed extensions.
  • Default timezone check has been added : since PHP 5.4, you need to have a default timezone set or PHP will complain. This is ofcourse only useful if you run the tests on a system with identical settings as your production environment.
  • A check for the removed functionality on break and continue was added. (Using a variable or function call as a parameter on break and continue is no longer allowed.)
  • 2 algorithms were removed in the hash extension, so there’s a check for that as well

Where to get it

2 options :

  • Using git : run this in your PHP_CodeSniffer/Standards directory :
    ~ > git clone git://github.com/wimg/PHPCompat_CodeSniffer.git PHPCompatibility
  • Downloading a zip : download here and unzip the file in PHP_CodeSniffer/Standards/PHPCompatibility

How to run it

Start PHP_CodeSniffer like this :

phpcs --standard=PHPCompatibility <path-to-your-PHP-source-directory>

Enjoy !

As always, any feedback (or patches on Github) welcome !

flattr this!

Zendcon, ACL talk, conferences and other stuff

Tuesday, October 25th, 2011

ACL talk (Zend Webinar)
Remember I promised to post the code of my ACL Webinar somewhere in August ? That didn’t really happen, partly because of a lack of time, partly because after my initial hard drive crash (which made me lose my slides and code), I had another crash in August and then my boot SSD drive crashed in September. Dell was kind enough to replace the power supply, motherboard and 1 disk, but my data was lost (unless I pay over 500EUR to have it recovered, which is a bit too pricy for my liking).
So all those setbacks caused a lot of delay on my promise. Nevertheless, I presented the talk again at the Zendcon Unconference, also mentioning the plans I have in store for version 2. But ofcourse, I’ll have to release version 1 first. Currently I’m using DHTMLX Treeview for the backend treeview interface, but I’m not allowed to redistribute the commercial version I bought. So as soon as I can replace the backend treeview interface with a free one, I’ll release the entire code, including instructions on how to set it up. And since development for version 2 is already underway, I want to make sure I make a good choice there ;-)

Zendcon 2011
Last week I spent a few days at Zendcon in Santa Clara, CA. I saw lots of interesting session there and presented 2 sessions during the Zendcon Unconference (community style version of the main conference) :

  • Creating dynamic ACLs in Zend Framework : the Zend Webinar I presented in August
  • Scaling dynamic sites like static sites : a first glimpse on a new Nginx module we’re building to make dynamic sites behave more like static sites in terms of scalability, without losing their dynamic nature

I received some encouraging comments, so I’m looking forward to presenting more on these topics in the next few months. The Nginx talk should also have some real-world benchmarks the next time I present it.
If you saw either one of my talks, please rate it at Joind.in

Next talks
I’m scheduled to talk at 2 more conferences this year :

  • T-Dose (Technical Dutch Open Source Event) in Eindhoven, The Netherlands on Nov 5-6, 2011 :
    • Nov 5 @ 11:00 : Caching and Tuning fun for high scalability – the talk I presented at phpBenelux, Dyncon and FrOSCon, this time in a condensed 50 minute version – this talk discusses the techniques you can use to keep your site running when it goes from 5 to 5 million visitors/day
    • Nov 6 @ 12:00 : Beyond the code : it’s not (just) about the code ! – a brand-new talk that’s aimed at 80% of developers. Short summary : “Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.”
  • PHP Tour in Lille, France on Nov 24-25, 2011 : Caching and Tuning fun for high scalability – the same talk as on T-Dose, in a condensed version

Working on…
In the next few weeks, expect a few new posts about :

  • A cool new IPv6 project we’ll launch soon
  • Some Zend Framework 2 news and stuff
  • More news on the Nginx module we’re building. At Zendcon, there were 3 large PHP hosters who were interested in testing the solution, so you can expect more posts on that.

flattr this!

Talks done and talks to come

Monday, June 27th, 2011

I haven’t really been updating my blog lately because of time constraints. I do have a few interesting topics to write about, although some of those have already been converted to talks I want to give at conferences over the next few months (if I get accepted ofcourse).

About those talks : I gave a tutorial called ‘Caching and tuning fun for high scalability’ at phpBenelux in January. It was my first conference talk and I enjoyed it a lot.
So much in fact, that I submitted the same talk for Dyncon2011 in Stockholm in March, where I gave a slightly shorter, but probably much better talk (learned from some of the mistakes I made in the first talk). Slides of this talk can be found at Slideshare although waiting for the video recording might be better, since there’s a lot of stuff not being shown on the slides (such as the live benchmarks).
If you were there, feel free to rate my talk at Joind.in : phpBenelux or Dyncon.

Mid-June I gave a Zend Webinar titled ‘Creating fast, dynamic ACLs in Zend Framework’, where I discussed alternatives to Zend_Acl using reflection and caching. I was happy to see more than 80 people watching the live webinar and got lots of interesting questions. The video is available on the Zend Webinar site. Any feedback most welcome via SpeakerRate.
I promised to publish the code for the ACL implementation and that’s still on my todo list. I hope to be able to do this by the end of July (don’t want to make unrealistic promises…).

In the coming months, I’ll be giving the caching and tuning tutorial at FrOSCon (with a new bonus feature near the end… a first glimpse of a new feature for Nginx) near Bonn, Germany in August and at PHP Tour in Lille, France in November.

I’m not entirely sure if I’ll attend Zendcon 2011 yet. Although I promised Michelangelo Van Dam to help out with the Unconference last year, I had to cancel my trip due to my grandmother passing away on the morning of departure. Maybe this year I can actually keep that promise (if I can find the budget).

flattr this!